I tried to implement DES algorithm using pyDes and Crypto.Cipher.DES modules. I found a problem that when I encrypt with 82514145
key and then decrypt the cipher with 93505044
I can retrieve the decrypted text. I found 256 keys behaving like this. This is 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)
Output is:
plain Text: asdfghij
the cipher text is @�Z����
the decrypted text is: asdfghij
Is there any mistake in my work? I got same results with pyDes also.