Hi Eric -
> I was wondering if someone could explain to me why in the eagle book it
> is necessary to perform
> an md5 twice before sending a mac_check to a user of a number of
> fields. I read in the mod_perl book that this is done 'to prevent
> technically savy users from appending data to the @fields'.
>
> my $mac_check = md5_hex($secret,
> md5_hex(join '', $secret, @fields));
<disclaimer> I am not a crypto expert </disclaimer>
There is a good explanation starting on page 5 of this:
ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto1n1.pdf
Basically because the algorithm is iterative and pads the length of input
data to multiples of 512 bits, you can start with a MAC that came from
MD5(secret + data), and use it to create a new MAC that corresponds to
MD5(secret + data + pad + appended_data), without ever knowing what the
original secret was.
As an alternative to MD5(secret + data), the authors recommendations
include:
MD5(secret + MD5(secret + data) )
or possibly better:
MD5(secret1 + MD5(secret2 + data) )
Hope this helps!
Larry Leszczynski
[EMAIL PROTECTED]