Subject: Re: [hybi] 64-bit comment

From: Erik Möller <[email-masked]>
Date: Mon, 16 Aug 2010 17:13:12 +0200

On Wed, 21 Jul 2010 09:19:38 +0200, Ian Hickson <[email-masked]> wrote:

> On Thu, 24 Jun 2010, Erik Möller wrote:
>>
>> [43. Let expected be the MD5 fingerprint of challenge as a big-endian  
>> 128 bit
>> string. [RFC1321]]
>>
>> A comment on the 64-bit issue of that code could be helpful I think. If  
>> you're
>> just trying WebSockets on for size and do a simple server you're likely  
>> just
>> going to use the code from rfc1321 to calculate the Md5 and it's pretty  
>> easy
>> to miss the fact that it contains the following definition:
>>
>> /* UINT4 defines a four byte word */
>> typedef unsigned long int UINT4;
>>
>> Works fine on 32-bit OS and LLP64 (i.e. Win64) but on any other 64-bit  
>> OS
>> that's going to typedef UINT4 to be 8 bytes which will happily compile  
>> without
>> errors but will produce an incorrect hash.
>
> I'm very happy to include a note here, what text would you suggest?
>

Perhaps something like this: "Note that the reference implementation in  
rfc1321 defines a 4-byte integer as unsigned long int which does not hold  
true on all 64-bit operating systems."

-- 
Erik Möller
Core Developer
Opera Software