static void MDString ( unsigned char *input)
{
MD5_CTX context;
unsigned char digest[16];
unsigned int len = sizeof(input);//strlen (const char*)
md5.MD5Init (&context);
md5.MD5Update (&context, input, len);
// void MD5Update (MD5_CTX *context, unsigned char *input, unsigned
int inputLen);
md5.MD5Final (digest, &context);
// printf ("MD5%d (\"%s\") = ", MD5, string); <= i have no idea what
is it for????
MDPrint (digest);
printf ("\n");
}
This code have bugging me for few days now. Basically, i am rewriting
and transform some of information from rfc-1321 to reusable state
(using Dev C++ - 4.9.9.2). I made mistake in this code that
"sizeof(input)" is always ==4 so the maximum characters that md5 can
disgest is 4! But no way i can get the length of "unsigned char *input"
since it is just unsigned char type not an array, if i do "static void
MDString ( unsigned char *input[16]), i willl get error.
//// Original code from the doc ///////////////
static void MDString (string)
char *string;
{
MD_CTX context;
unsigned char digest[16];
unsigned int len = strlen (string);
MDInit (&context);
MDUpdate (&context, string, len);
MDFinal (digest, &context);
printf ("MD%d (\"%s\") = ", MD, string);
MDPrint (digest);
printf ("\n");
}
I feel that i have misinterpreted some part of the code but i can't
figure it out. Can you suggest me something?(except reading a book
cause i already am)
Btw, I am still a newbie and want to improve my coding skill! Thanks!