Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the md5sum linux command working right?

Tags:

linux

shell

md5

According to Wikipedia, the md5 sum of an empty string is d41d8cd98f00b204e9800998ecf8427e

I confirmed this with my md5 library

However, when I run

echo "" | md5sum

in my linux shell, I get 68b329da9893e34099c7d8ad5cb9c940 -

In fact, none of my hashes match the output of the md5sum command.

Any thoughts on this discrepancy?

like image 321
Krystian Cybulski Avatar asked Nov 04 '25 20:11

Krystian Cybulski


1 Answers

With that command, you are calculating the md5sum of a single newline character. Try instead:

echo -n "" | md5sum
like image 154
caf Avatar answered Nov 07 '25 10:11

caf