|
About
TODO
Blog
RSS
Old blog
Projects
Gallery
Notes
Sun, 01 Apr 2007
#define f1(x,y,z) (z ^ (x & (y ^ z))) /* x ? y : z */
#define K1 0x5A827999L /* Rounds 0-19: sqrt(2) * 2^30 */]
for (i = 0; i < 20; i++) {
t = f1(b, c, d) + K1 + rol32(a, 5) + e + W[i];
e = d; d = c; c = rol32(b, 30); b = a; a = t;
}
Where $a, $b, $c, $d and $e are parts of the digest, W[i] is i'th word
of the input. Does it look similar to this one:
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<<8); \
c -= a; c -= b; c ^= (b>>13); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<16); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>3); \
b -= c; b -= a; b ^= (a<<10); \
c -= a; c -= b; c ^= (b>>15); \
}
For me it does - it is roughly the same GF(2) and GF(2^32) transformations,
but with different arguments and operations, but the ground is the same.So, I have quite ambitious goal to write a similar to this code for new type of the hash. But I'm not sure if I will have a time, but at least it is interesting. Quoted above code snipet is part of the well-known hash, other 3 parts are essentially the same with different f?() function.
/devel/math/hash :: Link / Comments (0) Please solve this captcha to be allowed to post (need to reload in a minute): 50 + 64 Comments are closed for this story. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||