Difference between OS X md5 and gnu md5sum

By default, echo leaves a trailing newline. So you need to do:

echo -n Hello | md5sum

8b1a9953c4611296a827abf8c47804d7

Consider this:

$ echo Hello | md5sum 
09f7e02f1290be211da707a266f153b3  -
$ echo -n Hello | md5sum
8b1a9953c4611296a827abf8c47804d7  -

In the first case, you hash six bytes, for 'H', 'e', 'l', 'l', 'o' and a newline character (0x0A). In the second, you don't include the newline character, which mimics what OS X md5 utility does with the argument -s.

Tags:

Macos

Hash

Md5