1
$\begingroup$

I've implemented the md5 source from a crypt lib from http://sourceforge.net/projects/libcrypt/

The string I'm passing to md5 is ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890.

From the md5 provided by my system I receive this hash 26756d7b34ff23859568262596dc159d but from what I've implemented I'm getting, consistently, 11e16a7373051c77c51798c45611581c.

I'm sure both follow the standards for md5 but just use a different "starting point" to calculate the hashes? Should I continue using the methods I found over on sourceforge?

I'm very unfamiliar with terms in general; when I say "starting point" I'm imagining just this method in md5.c from libcrypt :

void md5_init(union hash_state * md)
{
 md->md5.state[0] = 0x67452301; // are these values standard to begin with?
 md->md5.state[1] = 0xefcdab89;
 md->md5.state[2] = 0x98badcfe;
 md->md5.state[3] = 0x10325476;
 md->md5.curlen = md->md5.length = 0;
}
$\endgroup$

closed as off-topic by otus, fgrieu, SEJPM, yyyyyyy, K.G. Oct 29 '15 at 13:12

  • This question does not appear to be about cryptography within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I get your system hash 2675... only when I include a line return, which you would get if you echo ABCD... | md5sum. Are you including that in your code? For simplicity you might check against the empty string, whose md5 hash is d41d8cd98f00b204e9800998ecf8427e, reproduce with echo -n | md5sum. $\endgroup$ – engineerC Oct 29 '15 at 5:19
  • $\begingroup$ @otus I added what I meant by "starting point"; $\endgroup$ – ŽaMan Oct 29 '15 at 6:02
  • $\begingroup$ @CaptainMurphy I tried echo -ne ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890. | md5 and got 1926c36634965ee9d911cae458f6badb; edit: I see now what you mean regarding testing just an empty string. I get this for empty string on my implementation: 85bd946a585af9fd3fb9eda68707c1d8 $\endgroup$ – ŽaMan Oct 29 '15 at 6:03
  • 4
    $\begingroup$ I'm voting to close this question as off-topic because it's about debugging code. $\endgroup$ – otus Oct 29 '15 at 6:09
  • 1
    $\begingroup$ @qumonio, in that case the first thing I would look at is string encoding. You could ask on Stack Overflow if you have a particular issue you are not sure you got right. $\endgroup$ – otus Oct 29 '15 at 6:23

Browse other questions tagged or ask your own question.