Perhaps a basic question
Ok, so I've been reading RFC 1321, the description of the md5 algorithm and there was a piece of code in there that completely baffled me.
It went like this:
This code works, but I want to know why. If the modulus operation can be done with a bitwise AND, then is % just a substitution for &, or does it only work in a few cases? And if it isn't just a substitution, wouldn't & be faster than %?
It went like this:
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
This code works, but I want to know why. If the modulus operation can be done with a bitwise AND, then is % just a substitution for &, or does it only work in a few cases? And if it isn't just a substitution, wouldn't & be faster than %?
