On Sunday, June 22, 2003, at 10:07 PM, Mark Brownell wrote:
f = S1[a] + S2[b]
f = bitXor( f , S3[c] )
f = bitAnd( f + S4[d], -1 )
There are a couple problems, I think the same functionality is the cause though.
On the last line is the negative number -1. It is increased to 0 in a bit op.
On the first line and the last line are numbers that could go over the 32 bit range because of the carry. They are decreased to the top of the range in the bit op if they do.
put (S1[a] + s2[b]) mod 2^32 into f -- only init some var for 2^32 put f bitXor S3[c] into f put (f + S4[d]) mod 2^32 into f
If we had more than 32 bits to work with in bit ops we could mask instead of mod.
I don't know of a faster way than mod. Anybody?
Maybe... if f >= 2^32 then put f - 2^32 into f
I doubt that will be faster.
So your F function could be just 3 lines, then: the binaryEncode, the binaryDecode and the above 3 combined in the return.
function F halfBlock
put binaryEncode(...
put binaryDecode(...
return ( ( ((S1[a] + S2[b]) mod 2^32) bitXor S3[c] ) + S4[d] ) mod 2^32
end F
Dar Scott
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
