Sean Shao wrote:

Sorry for the post earlier, but it seems that there's a small error in it.. Here are the 3 fixed bitwise shift operators (shiftLeft (<<), shiftRight (>>) and shiftRightZero (>>>)).. Basically there are some integer combinations that would make the other formulas fail and sometimes the shiftRightZero would return a negative integer (which is impossible).. So here are the three corrected functions:

Thanks again for these functions, and for all the time it must have taken to figure out what you can do and what you can't.

Alejandro got me interested in the md4digest function, so I tried it using your functions, and I'm afraid there is still one problem.

One example that fails is
 put 6448964192 into tVar
 put bitwiseShiftRightZero(tVar, 29) into tResult
 put format("%08x %08x", tVar, tResult) into msg

This results in
80636260         0000000C
when it should give
80636260         00000004

The problem is that 6448964192 is a positive number which has the "sign" bit set - i.e. it's larger than a single 32-bit positive integer can hold, but Rev 2.6.1 uses (I guess??) 64-bit ints if needed (??)

I added the following (very inelegant) code to the start of each of your functions, and all appears to be now OK.

  repeat while p1 > 2^31
     put p1 - 2^32 into p1
  end repeat

My attempt at the md4digest function now passes all the short test cases from the reference implementation, but still fails on the long ones ..... sigh :-(

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.7/182 - Release Date: 24/11/2005

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to