Why does not changing one bit in the key or the initial value of Triple DES does not produce different encrypted data?

I use pyDes to encrypt some data. I would like to demonstrate that if you change at least one bit in a key or initial value, the encrypted data will be completely different. I set a 16-byte key to change the last character to +/- 1, resulting in at least one bit different. However, even when I do this, three different instances of encrypted data are not all different.

from pyDes import *

data = 'Hello'

# CBC : Cipher-Block-Chaining
# \0..\1: arbitrary initial value for CBC
# pad=None: let pyDes take care of padding bytes
k1 = triple_des("16-byte-key-here", CBC, "\0\0\0\0\0\0\0\1", pad=None, padmode=PAD_PKCS5)
k2 = triple_des("16-byte-key-herf", CBC, "\0\0\0\0\0\0\0\1", pad=None, padmode=PAD_PKCS5)
k3 = triple_des("16-byte-key-herd", CBC, "\0\0\0\0\0\0\0\1", pad=None, padmode=PAD_PKCS5)

d1 = k1.encrypt(data)
d2 = k2.encrypt(data)
d3 = k3.encrypt(data)

assert d1 != d2
assert d2 != d3
assert d1 != d3

, , , , ; , d1 != d2 d1 != d3 , . 'Hello' 'Hello' * 50, , , .

, . , , d1 != d3 ( , k1-k2 - 2 ).

, , , , , , , , ,

- ? DES ? PyDes? , - ?

</" > @Chris Jester-Young , . , , :

, DES 64 , , DES, 56 . ( ) , 1 . , , 56 . , Triple DES 168 , 8 , .

( )

, .

!

+3
1

DES /.

+4

Source: https://habr.com/ru/post/1715271/


All Articles