3 ms·
This can also be important for routines that treat structures as strings of bytes. e.g. void MD5( unsigned char *pStructure, size_t size ); struct foo { c
by jstelly 10y ago
This can also be important for routines that treat structures as strings of bytes. e.g.
void MD5( unsigned char *pStructure, size_t size );
struct foo
{
char a;
int x;
};
if I MD5( &foo, sizeof(foo) ); on two foo with the same a & x, they may not produce the same MD5 because the pad bytes might contain noise from the stack or heap.
The solution is to either zero memory on anything you will MD5 or explicitly declare all of the padding (easy if you have internalized the rules) so your code can handle it.