Generating a digest
Posted: Thu May 04, 2006 6:58 am
I need to calculate a response for an SMTP server in a challege/response authentication mechanism. There's little documentation and the RFC was confusing me so I found a tutorial online but I'm stuck it putting this tiny part here into PHP.
"password" is a variable that I know, and "challege" is also a variable I've decoded.... I'm just not sure how that C code translates to PHP. Namely, the outer MD5() has 3 paramaters in it 
Is it something like:
?
Cheers
The client generates a digest using the following MD5 hashing algorithm (where password is null-padded to a length of 64 bytes, ipad is 0x36 repeated 64 times and opad is 0x5C repeated 64 times):
Code: Select all
digest = MD5((password XOR opad), MD5((password XOR ipad), challenge))Is it something like:
Code: Select all
$digest = md5( md5($password ^ str_repeat(0x5C, 64)) . md5($password ^ str_repeat(0x36, 64)) . $challenge);Cheers