Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

alt

Daniel Nashed

SHA512 is faster than SHA256

Daniel Nashed – 13 May 2022 09:07:05

Quite interesting results..
I have been looking into different hash algorithms to see the overhead today.

It turns out that SHA256 is the slowest option and SHA1 is the winner.
But it is interesting, that SHA384/SHA512 are also faster than SHA256.


My main interest right now is in SHA algorithms for checking large files.
But SHA algorithms come into play in may other scenarios.
In general I would avoid SHA256 if possible. For security related operations SHA384 looks like the better option.

For file operations where you calculate a file HASH and SHA1 is probably the best choice.
You can combine the file hash also with the size of the file, if you are really paranoid.
Actually this is what the Domino DAOS NLO hash uses for objects representing the files off-loaded from the NSF databases.

I wrote a test tool building a hash from in memory block of 64 KB size in a long loop to get relevant data.


MD5    :   278 MB/sec

SHA1   :   388 MB/sec

SHA256 :   179 MB/sec

SHA384 :   276 MB/sec

SHA512 :   274 MB/sec



This is matches command-line Linux tool performance with a file that was in cache already.


In normal cases your file I/O is probably the limiting factor.
But if hash performance is important in large scale operations -- like DAOS hashes for example, SHA1 is still a really good choice -- specially in combination with file-size.


If you really care about a very unique file hash on it's own, SHA384 might be the best choice today.


But for standard file hashes, I would still go with SHA1.





Test on Linux with a file in cache


time sha1sum Domino_12.0.1_Linux_English.tar

8eb2ff4d480c001866db3dcd90b8cd3fcb372d37  Domino_12.0.1_Linux_English.tar


real    0m1.434s

user    0m1.177s


time sha256sum Domino_12.0.1_Linux_English.tar

a9d561b05f7b6850ed1230efa68ea1931cfdbb44685aad159613c29fa15e5eea  Domino_12.0.1_Linux_English.tar


real    0m2.706s

user    0m2.505s


time sha384sum Domino_12.0.1_Linux_English.tar

7b321875a5a0f5f48701fb9760a6558f80a04ca606a32e5747369f67045cf0a9cd44242ff5efb9f39c02fd6c59a20002  Domino_12.0.1_Linux_English.tar


real    0m1.985s

user    0m1.827s


time sha512sum Domino_12.0.1_Linux_English.tar

3152bc50b94392942525a18ae14c9568bb6ea0977f6661a81fd83eff04c5e13d3cc6187dc44648d9bb57cdc362d3810c5cfe4663f8918d8618255a458ec1119a  Domino_12.0.1_Linux_English.tar


real    0m1.908s

user    0m1.744s

Comments
No Comments Found

Links

    Archives


    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]