Cryptography Reference
In-Depth Information
( block[ ( t * 4 ) + 2 ] << 8 ) |
( block[ ( t * 4 ) + 3 ] );
}
else
{
W[ t ] = sigma_shr( W[ t - 2 ], 1 ) +
W[ t - 7 ] +
sigma_shr( W[ t - 15 ], 0 ) +
W[ t - 16 ];
}
}
a = hash[ 0 ];
b = hash[ 1 ];
c = hash[ 2 ];
d = hash[ 3 ];
e = hash[ 4 ];
f = hash[ 5 ];
g = hash[ 6 ];
h = hash[ 7 ];
for ( t = 0; t < 64; t++ )
{
T1 = h + sigma_rot( e, 1 ) + ch( e, f, g ) + k[ t ] + W[ t ];
T2 = sigma_rot( a, 0 ) + maj( a, b, c );
h = g;
g = f;
f = e;
e = d + T1;
d = c;
c = b;
b = a;
a = T1 + T2;
}
hash[ 0 ] = a + hash[ 0 ];
hash[ 1 ] = b + hash[ 1 ];
hash[ 2 ] = c + hash[ 2 ];
hash[ 3 ] = d + hash[ 3 ];
hash[ 4 ] = e + hash[ 4 ];
hash[ 5 ] = f + hash[ 5 ];
hash[ 6 ] = g + hash[ 6 ];
hash[ 7 ] = h + hash[ 7 ];
// deal with little-endian-ness
for ( i = 0; i < 8; i++ )
{
hash[ i ] = htonl( hash[ i ] );
}
}
Search WWH ::




Custom Search