1

Topic: Erlang simple enciphering MD5

All greetings! There is at me here such code public static string Encrypt (string text, string key) {byte [] inputBuffer = Encoding. UTF8.GetBytes (text); byte [] keyHash = new MD5CryptoServiceProvider ().ComputeHash (Encoding. UTF8.GetBytes (key)); TripleDESCryptoServiceProvider provider2 = new TripleDESCryptoServiceProvider {Key = keyHash, Mode = CipherMode. ECB, Padding = PaddingMode. PKCS7}; byte [] inArray = provider2.CreateEncryptor ().TransformFinalBlock (inputBuffer, 0, inputBuffer. Length); return inArray. ToHexString ();} It is necessary to translate this piece of the code erlang. I can not find In any way where to dig. In cryptography it is not strong - in a class crypto looked aside des_ecb_encrypt, but there a key of 8 byte (here MD5 a hash 16) - in methods des3* somehow too many parameters Prompt in what side to look....

2

Re: Erlang simple enciphering MD5

Hello, - Cheese - you wrote: a C> All greetings! The C> is at me here such code I only did not understand, at what here MD5 in title, if in a body 3DES. Than the key is formed - does not concern directly the cipher. The C> Need to be translated this piece of the code erlang. I can not find In any way where to dig. In cryptography the C> is not strong - in a class crypto looked aside des_ecb_encrypt, but there the key (here MD5 a hash 16) Normal 3DES receives of 8 byte on an input two 64-bit keys, all is correct. The C> - in methods des3* somehow is too much C parameters> Prompt in what side to look.... 1. ECB it is each unit it is ciphered separately (without chains of dependences). Accordingly, it is necessary to initialize each time the received key. 2. des3_key in crypto (I look on Erlang 18.1) has 3 keys on an input. Then key3 == key1. 3. To use from cash in crypto, for example, des3_cbc, but the key changed by its results - to ignore, beginning each time with an initial key. 4. And further to cause crypto:block_encrypt/4 (see ), Type == des3_cbc, Key it is formed, as it is described, to submit on an input in the portions on 8 byte (that it in itself(himself) did not include CBC). Here what to do with a final part - here I will not tell, it is necessary to experiment.

3

Re: Erlang simple enciphering MD5

Hello, netch80, you wrote: N> I only did not understand, at what here MD5 in title, if in a body 3DES. Than the key is formed - does not concern directly the cipher. It I was sealed up... Certainly speech about 3DES