Under the assumption that disk I/O and free RAM is a bottleneck (while CPU time is not the limitation), does a tool exist that can calculate multiple message digests at once?
I am particularly interested in calculating the MD-5 and SHA-256 digests of large files (size in gigabytes), preferably in parallel. I have tried openssl dgst -sha256 -md5
, but it only calculates the hash using one algorithm.
Pseudo-code for the expected behavior:
for each block:
for each algorithm:
hash_state[algorithm].update(block)
for each algorithm:
print algorithm, hash_state[algorithm].final_hash()
Best Answer
Check out
pee
("tee standard input to pipes
") frommoreutils
. This is basically equivalent to Marco'stee
command, but a little simpler to type.