I tried to implement the DES algorithm using the pyDes and Crypto.Cipher.DES modules. I found that when I encrypt the key 82514145 and then decrypt the cipher with 93505044 , I can get the decrypted text. I found 256 keys that behave like this. This is a violation of cryptography. My code is as follows:
from Crypto.Cipher import DES plain_text = 'asdfghij' print 'plain Text: ', plain_text des = DES.new('82514145', DES.MODE_ECB) cipher_text = des.encrypt(plain_text) print 'the cipher text is ', cipher_text des = DES.new('93505044', DES.MODE_ECB) print 'the decrypted text is: ', des.decrypt(cipher_text)
Exit:
plain Text: asdfghij the cipher text is @ Z the decrypted text is: asdfghij
Is there any mistake in my work? I also got results with pyDes.
python cryptography encryption-symmetric des pycrypto
ceasif
source share