Info about mdxxxsums observations

Using the current endeavouros as shown below. Here are some timings:

time md5sum *iso
f6d8faa00a42083804bba1d4b4a8b636 endeavouros-2020.07.15-x86_64.iso

real 0m2.349s
user 0m2.192s
sys 0m0.153s

time sha1sum *iso
400ff93b7da62370a347b1c7234b4f144a0d18c3 endeavouros-2020.07.15-x86_64.iso

real 0m2.568s
user 0m2.430s
sys 0m0.130s

time sha256sum *iso
6ee98a8cf9cfca4946b54a82d0e2fe8d8db951d3be2402e193f63dbb4f0dc23f endeavouros-2020.07.15-x86_64.iso

real 0m1.024s
user 0m0.894s
sys 0m0.124s

It seems that the sha256sum runs the fastest, with consuming the least cpu time.

How many times did you run the test? sha1 should be faster then sha256 in theory. They use the same block size but sha1 is a simpler algorithm. I did some quick testing and for me sha1 was always faster.

Your results could be more about testing differences due to caching or other activities. If you want to bench them for some reason you might consider taking the average of multiple tests.

That being said, the differences are pretty minimal since most of the time is probably io reading the iso.

2 Likes

This.

A lot of the benchmarks people do are actually testing IO rather than anything else. For example, build a kernel on a 5400rpm 2.5" HDD and it will take far longer than building in RAM, no matter what CPU you’re using.

2 Likes

That’s probably because modern CPUs have optimisations for some hashing and crypto algorithms, for example AES.

And, as has been mentioned by dalto and jonathon, I/O.

Try copying your iso to /tmp and running your measurements again maybe?
Btw, sha512 should be about as fast as sha256 on 64-bit CPUs.

I would think sha512 could potentially be even fast than sha256 on larger files given it’s bigger block size.

1 Like
CONFIG_CRYPTO_SHA256_SSSE3:        
SHA-256 secure hash standard (DFIPS 180-2) implemented
using Supplemental SSE3 (SSSE3) instructions, or Advanced Vector
Extensions version 1 (AVX1), or Advanced Vector Extensions
version 2 (AVX2) instructions, or SHA-NI (SHA Extensions New 
Instructions) when available.

BLAKE2 is best for performance, but not that widespread yet…

Haven’t tested BLAKE3 though, wonder how it goes :thinking:

It will be interesting when they get to Blake’s 7.

1 Like

Come on, it’s super-fast compared to any sha already :slight_smile:

No, you. :stuck_out_tongue_closed_eyes:

5 Likes

I have one partition mounted /ISOs with many current ISOs.
sha256sum appears to be faster than does md5sum, or sha1sum.

By the way, I did copy the endeavourOS to /tmp, which is a ram partition.

I was just pointing out an anomalie, and I am not saying that md5sum is inadequate. It definitely is definitely more than adequate to use to verify that no downloaded corruption occurred.

I was purely timing the verious sha*sum algorithms against md5sum.