本文整理汇总了Python中Crypto.Random.Fortuna.FortunaAccumulator.min_pool_size方法的典型用法代码示例。如果您正苦于以下问题:Python FortunaAccumulator.min_pool_size方法的具体用法?Python FortunaAccumulator.min_pool_size怎么用?Python FortunaAccumulator.min_pool_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crypto.Random.Fortuna.FortunaAccumulator
的用法示例。
在下文中一共展示了FortunaAccumulator.min_pool_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_accumulator_pool_length
# 需要导入模块: from Crypto.Random.Fortuna import FortunaAccumulator [as 别名]
# 或者: from Crypto.Random.Fortuna.FortunaAccumulator import min_pool_size [as 别名]
def test_accumulator_pool_length(self):
"""FortunaAccumulator.FortunaAccumulator minimum pool length"""
fa = FortunaAccumulator.FortunaAccumulator()
# This test case is hard-coded to assume that FortunaAccumulator.min_pool_size is 64.
self.assertEqual(fa.min_pool_size, 64)
# The PRNG should not allow us to get random data from it yet
self.assertRaises(AssertionError, fa.random_data, 1)
# Add 60 bytes, 4 at a time (2 header + 2 payload) to each of the 32 pools
for i in range(15):
for p in range(32):
# Add the bytes to the pool
fa.add_random_event(2, p, b("XX"))
# The PRNG should not allow us to get random data from it yet
self.assertRaises(AssertionError, fa.random_data, 1)
# Add 4 more bytes to pool 0
fa.add_random_event(2, 0, b("XX"))
# We should now be able to get data from the accumulator
fa.random_data(1)