本文整理匯總了Python中Crypto.Random.Fortuna.FortunaAccumulator.FortunaPool方法的典型用法代碼示例。如果您正苦於以下問題:Python FortunaAccumulator.FortunaPool方法的具體用法?Python FortunaAccumulator.FortunaPool怎麽用?Python FortunaAccumulator.FortunaPool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypto.Random.Fortuna.FortunaAccumulator
的用法示例。
在下文中一共展示了FortunaAccumulator.FortunaPool方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_FortunaPool
# 需要導入模塊: from Crypto.Random.Fortuna import FortunaAccumulator [as 別名]
# 或者: from Crypto.Random.Fortuna.FortunaAccumulator import FortunaPool [as 別名]
def test_FortunaPool(self):
"""FortunaAccumulator.FortunaPool"""
pool = FortunaAccumulator.FortunaPool()
self.assertEqual(0, pool.length)
self.assertEqual("5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456", pool.hexdigest())
pool.append(b('abc'))
self.assertEqual(3, pool.length)
self.assertEqual("4f8b42c22dd3729b519ba6f68d2da7cc5b2d606d05daed5ad5128cc03e6c6358", pool.hexdigest())
pool.append(b("dbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"))
self.assertEqual(56, pool.length)
self.assertEqual(b('0cffe17f68954dac3a84fb1458bd5ec99209449749b2b308b7cb55812f9563af'), b2a_hex(pool.digest()))
pool.reset()
self.assertEqual(0, pool.length)
pool.append(b('a') * 10**6)
self.assertEqual(10**6, pool.length)
self.assertEqual(b('80d1189477563e1b5206b2749f1afe4807e5705e8bd77887a60187a712156688'), b2a_hex(pool.digest()))