本文整理匯總了Python中Crypto.Random.Fortuna.FortunaAccumulator.which_pools方法的典型用法代碼示例。如果您正苦於以下問題:Python FortunaAccumulator.which_pools方法的具體用法?Python FortunaAccumulator.which_pools怎麽用?Python FortunaAccumulator.which_pools使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypto.Random.Fortuna.FortunaAccumulator
的用法示例。
在下文中一共展示了FortunaAccumulator.which_pools方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_which_pools
# 需要導入模塊: from Crypto.Random.Fortuna import FortunaAccumulator [as 別名]
# 或者: from Crypto.Random.Fortuna.FortunaAccumulator import which_pools [as 別名]
def test_which_pools(self):
"""FortunaAccumulator.which_pools"""
# which_pools(0) should fail
self.assertRaises(AssertionError, FortunaAccumulator.which_pools, 0)
self.assertEqual(FortunaAccumulator.which_pools(1), [0])
self.assertEqual(FortunaAccumulator.which_pools(2), [0, 1])
self.assertEqual(FortunaAccumulator.which_pools(3), [0])
self.assertEqual(FortunaAccumulator.which_pools(4), [0, 1, 2])
self.assertEqual(FortunaAccumulator.which_pools(5), [0])
self.assertEqual(FortunaAccumulator.which_pools(6), [0, 1])
self.assertEqual(FortunaAccumulator.which_pools(7), [0])
self.assertEqual(FortunaAccumulator.which_pools(8), [0, 1, 2, 3])
for i in range(1, 32):
self.assertEqual(FortunaAccumulator.which_pools(2L**i-1), [0])
self.assertEqual(FortunaAccumulator.which_pools(2L**i), range(i+1))
self.assertEqual(FortunaAccumulator.which_pools(2L**i+1), [0])
self.assertEqual(FortunaAccumulator.which_pools(2L**31), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**32), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**33), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**34), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**35), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**36), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**64), range(32))
self.assertEqual(FortunaAccumulator.which_pools(2L**128), range(32))
示例2: test_which_pools
# 需要導入模塊: from Crypto.Random.Fortuna import FortunaAccumulator [as 別名]
# 或者: from Crypto.Random.Fortuna.FortunaAccumulator import which_pools [as 別名]
def test_which_pools(self):
"""FortunaAccumulator.which_pools"""
# which_pools(0) should fail
self.assertRaises(AssertionError, FortunaAccumulator.which_pools, 0)
self.assertEqual(FortunaAccumulator.which_pools(1), [0])
self.assertEqual(FortunaAccumulator.which_pools(2), [0, 1])
self.assertEqual(FortunaAccumulator.which_pools(3), [0])
self.assertEqual(FortunaAccumulator.which_pools(4), [0, 1, 2])
self.assertEqual(FortunaAccumulator.which_pools(5), [0])
self.assertEqual(FortunaAccumulator.which_pools(6), [0, 1])
self.assertEqual(FortunaAccumulator.which_pools(7), [0])
self.assertEqual(FortunaAccumulator.which_pools(8), [0, 1, 2, 3])
for i in range(1, 32):
self.assertEqual(FortunaAccumulator.which_pools(2**i-1), [0])
self.assertEqual(FortunaAccumulator.which_pools(2**i), list(range(i+1)))
self.assertEqual(FortunaAccumulator.which_pools(2**i+1), [0])
self.assertEqual(FortunaAccumulator.which_pools(2**31), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**32), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**33), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**34), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**35), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**36), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**64), list(range(32)))
self.assertEqual(FortunaAccumulator.which_pools(2**128), list(range(32)))