Decrypt DES by password

Thomas Dybdahl Ahle thomas at localhost.localdomain
Mon May 15 09:40:49 EDT 2006


Hi, I've got some DES encrypted data, for which I know the password.
The problem is that I have to generate an 8byte key from the password.
I use python-crypto-2.0.1.

I also know, that the C# way to do the decryption is:
PasswordDeriveBytes bytes1 = new
PasswordDeriveBytes("passwordString", null);
byte[] array1 = new byte[8];
byte[] array2 = bytes1.CryptDeriveKey("DES", "MD5", 0, array1);

DESCryptoServiceProvider provider1 = new DESCryptoServiceProvider();
FileStream fs = new FileStream("fileNameString", FileMode.Open,
FileAccess.Read); CryptoStream cs = new CryptoStream(fs,
provider1.CreateEncryptor(array2, array1), CryptoStreamMode.Read);

Anybody know how to do this in python?

-- 
Programmers should realize their critical importance and responsibility in a
world gone digital. They are in many ways similar to the priests and monks of
Europe's Dark Ages; they are the only ones with the training and insight
to read and interpret the "scripture" of this age.




More information about the Python-list mailing list