Esempio n. 1
0
    def testPtxtPowerOf2(self):
        """Due to Issue#5"""
        plain = ffx.FFXInteger('0000065536', radix=10)
        tweak = ffx.FFXInteger('0000000000', radix=10)
        key = ffx.FFXInteger('2b7e151628aed2a6abf7158809cf4f3c', radix=16, blocksize=32)

        ffx_obj = ffx.new(key.to_bytes(16), radix=10)
        ctxt = ffx_obj.encrypt(tweak, plain)
        self.assertEqual(ffx_obj.decrypt(tweak, ctxt), plain)
Esempio n. 2
0
 def testKeyWithLeadingNullByte2(self):
     """Due to Issue#2"""
     ffx_key = ffx.FFXInteger('0' * 128, radix=2, blocksize=128)
     key_len = len(ffx_key.to_bytes(16))
     self.assertEquals(key_len, 16)
Esempio n. 3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import ffx

radix = 2
blocksize = 2**10

K = ffx.FFXInteger('0' * 128, radix=radix, blocksize=128)
T = ffx.FFXInteger('0' * blocksize, radix=radix, blocksize=blocksize)
X = ffx.FFXInteger('0' * blocksize, radix=radix, blocksize=blocksize)

ffx_obj = ffx.new(K.to_bytes(16), radix=radix)

C = ffx_obj.encrypt(T, X)
Y = ffx_obj.decrypt(T, C)

print X
print C
print Y