当前位置: 首页>>代码示例>>Python>>正文


Python FortunaAccumulator.which_pools方法代码示例

本文整理汇总了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)) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:28,代码来源:test_FortunaAccumulator.py

示例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))) 
开发者ID:summerwinter,项目名称:SublimeRemoteGDB,代码行数:28,代码来源:test_FortunaAccumulator.py


注:本文中的Crypto.Random.Fortuna.FortunaAccumulator.which_pools方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。