curl-library
Re: ROTATE_LEFT macro in md5.c file
From: Michael Wood <esiotrot_at_gmail.com>
Date: Wed, 27 Jan 2010 13:55:53 +0200
Date: Wed, 27 Jan 2010 13:55:53 +0200
2010/1/27 vick <vijayx_at_gmail.com>:
> I was browsing and came across this snippet:-
> #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
> maybe rather than using "32" above, it might make more sense to use sizeof
> (int) or something like that which is machine independent and therefore less
> prone to cause bugs on unusual cpu architectures? Of course, i am not in a
> position to change/verify this myself or submit a commit.
If you look here:
http://en.wikipedia.org/wiki/MD5#Algorithm
you will see that the code works on 32 bit "words", so the above seems
to me to be correct and should not depend on the platform's native int
size.
-- Michael Wood <esiotrot_at_gmail.com> ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-01-27