I'm trying to run the md5 source code on my linux machine. I got the code from here: https://www.rfc-editor.org/rfc/rfc1321.
At the bottom of the link, it claims that the output of the MD5 test suite should be the following:
MD5 test suite:
MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
d174ab98d277d9f5a5611c2c9f419d9f
MD5 ("123456789012345678901234567890123456789012345678901234567890123456
78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
In my md5 folder I have the following:
global.h
md5c.c
md5.h
mddriver.c
When I tried to compile at first it threw an error in mddriver.c saying that 'line 20 MD5 is undefined' (or something similar), so I changed line 20 from '#define MD MD5' to '#define MD 5'. This works and seems to make sense given the rest of the code.
I compile using the following while in the MD5 folder:
gcc -Wall *.c -o out
and this created the file 'out' that I can run using
./out -x
where the argument '-x' is to run the test suite. However, I get the following output for './out -x':
MD5 test suite:
MD5 ("") = e4c23762ed2823a27e62a64b95c024e7
MD5 ("a") = 793a9bc07e209b286fa416d6ee29a85d
MD5 ("abc") = 7999dc75e8da648c6727e137c5b77803
MD5 ("message digest") = 840793371ec58a6cc84896a5153095de
MD5 ("abcdefghijklmnopqrstuvwxyz") = 98ef94f1f01ac7b91918c6747fdebd96
MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = dabcd637cde443764c4f8aa099cf23be
MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e29c01a1e2a663c26b4a68bf7ec42df7
which is obviously not the same. Am I missing something? If you would like me to recreate the 'MD5 not declared' error let me know. Thanks.
global.h have:
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
Change global.h to:
#include <inttypes.h>
/* UINT2 defines a two byte word */
typedef uint16_t UINT2;
/* UINT4 defines a four byte word */
typedef uint32_t UINT4;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With