Question

Using the following command:

$ echo abc | sha1sum

I got the output:

03cfd743661f07975fa2f1220c5194cbaff48451

But according to the SHA standard http://www.itl.nist.gov/fipspubs/fip180-1.htm I should get:

a9993e364706816aba3e25717850c26c9cd0d89d

I suspect the incorrect result is caused by big or little-endian for w[0] and w[15]. w[0] should be 0x80636261 rather than 0x61626380. But I still can not get the correct result.

Who can help me?

Was it helpful?

Solution

You're calculating the SHA1 sum of "abc\n", i.e. that string with a new-line at the end.

Try:

echo -n abc | sha1sum
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top