Example #1
0
 def test_rc4_vector(self):
     x = prng.rc4()
     x.add_entropy(b'12345678')
     self.assertEqual(
         b16encode(x.read(8)),
         b'bbf339d409b1dea7'
     )
Example #2
0
    def test_rc4_lib_vector(self):
        x = prng.rc4()
        seed = b16decode(b'0123456789ABCDEF')
        x.add_entropy(seed)

        output = x.read(8)
        output = utils.xor_bytes(output, seed)

        self.assertEqual(b16encode(output), b'75b7878099e0c596')
Example #3
0
    def test_rc4_lib_vector(self):
        x = prng.rc4()
        seed = b16decode(b'0123456789ABCDEF')
        x.add_entropy(seed)
        
        output = x.read(8)
        output = utils.xor_bytes(output, seed)

        self.assertEqual(
            b16encode(output),
            b'75b7878099e0c596'
        )
Example #4
0
 def test_seeds(self):
     
     x = prng.fortuna()
     x.add_entropy(b'12345678')
     # print x.read(16).encode('hex')
     assert b16encode(x.read(16)).lower() == b'b1f2630e4b56ff6f1e0e5d6f1324a10d'
     
     x = prng.rc4()
     x.add_entropy(b'12345678')
     # print x.read(16).encode('hex')
     assert b16encode(x.read(16)).lower() == b'0a015ada42e721c8ee3d57a0b519a9a8'
     
     x = prng.sober128()
     x.add_entropy(b'12345678')
     # print x.read(16).encode('hex')
     assert b16encode(x.read(16)).lower() == b'39e10e5ccaa9a24c26abaf73dbf2e3f6'
     
     x = prng.yarrow()
     x.add_entropy(b'12345678')
     # print x.read(16).encode('hex')
     assert b16encode(x.read(16)).lower() == b'f63c36f72ad5098e42ac002243d2cce2'
Example #5
0
 def test_rc4_vector(self):
     x = prng.rc4()
     x.add_entropy(b'12345678')
     self.assertEqual(b16encode(x.read(8)), b'bbf339d409b1dea7')