> From: owner-openssl-us...@openssl.org On Behalf Of
muell...@mathematik.hu-berlin.de
> Sent: Monday, 13 September, 2010 05:08

> > md5(admin [NO NEWLINE])= 21232f297a57a5a743894a0e4a801fc3

> The next step is to understand the insertion of salt. I tried to
> understand 'enc.c' and 'evp_key.c', for key derivation EVP_BytesToKey() 
> is called. I am not familiar with things like MDcontexts; BIOs etc, 

man 3ssl EVP_MD_CTX_init # or wherever it is on your system

BIOs are used extensively in most of apps/*, but not relevant 
to this key derivation which is entirely in EVP_BytesToKey().

> so i don't understand it very well. But according to its documentation 
> it computes
> 
> D_0 = {}
> D_i = hash(d_{i-1}||data||salt)
> 
> After that the key and iv are taken from D_1, D_2, ...
> For DES it would be enough to generate D_1.

Yes. (Precisely because classic-DES is only 56-bit key 
it is now practical to bruteforce, and hence insecure 
for most use. I assume you will change later.)

> data = 'admin'
> As salt i use '0000000000000000', so 
> 'Salted__0000000000000000' is passed
> to EVP_BytesToKey - Anyway i cant reproduce
> 
> > openssl enc -des -k 'admin' -P -S 0000000000000000
> 
> salt=0000000000000000
> key=752B559CFABA36F6
> iv =9B6A524533353200
> 
> by hand. A Similar problem with
> 
Note that the value for -S (and -K(uppercase) and -iv) 
is hex, as is the output from -p/P (and dgst).

~/CSdev/hack $ od -xc t
0000000    6164    6d69    6e00    0000    0000    0000    0000
           a   d   m   i   n  \0  \0  \0  \0  \0  \0  \0  \0
0000015
~/CSdev/hack $ openssl <t md5 -binary |od -x
0000000 752b 559c faba 36f6 9b6a 5245 3335 3200
0000020


> openssl enc -blowfish -k 'admin' -P -nosalt
> key=21232F297A57A5A743894A0E4A801FC3 = md5(admin)
> iv =7BED69E4F5F533BE != md5(md5(admin)||admin)..
> 
> can someone give me some hints..
> 

~/CSdev/hack $ od -xc t0
0000000    6164    6d69    6e00
           a   d   m   i   n
0000005
~/CSdev/hack $ openssl <t0 md5 -binary >t1; od -x t1
0000000 2123 2f29 7a57 a5a7 4389 4a0e 4a80 1fc3
0000020
~/CSdev/hack $ cat t1 t0 | openssl md5 -binary | od -x 
0000000 7bed 69e4 f5f5 33be e8a4 19b5 7be5 f229
0000020


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to