示例#1
0
    def test_xor_bytes(self):
        self.assertEqual(
            b16encode(utils.xor_bytes(
                b16decode(b'0123456789abcdef'),
                b16decode(b'0000000000000000'),
            )),
            b'0123456789abcdef',
        )

        self.assertEqual(
            b16encode(utils.xor_bytes(
                b16decode(b'0123456789abcdef'),
                b16decode(b'0123456789abcdef'),
            )),
            b'0000000000000000',
        )
示例#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')
示例#3
0
    def test_xor_bytes(self):
        self.assertEqual(
            b16encode(
                utils.xor_bytes(
                    b16decode(b'0123456789abcdef'),
                    b16decode(b'0000000000000000'),
                )),
            b'0123456789abcdef',
        )

        self.assertEqual(
            b16encode(
                utils.xor_bytes(
                    b16decode(b'0123456789abcdef'),
                    b16decode(b'0123456789abcdef'),
                )),
            b'0000000000000000',
        )
示例#4
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'
        )