rhash / RHash

Great utility for computing hash sums
http://rhash.sf.net
BSD Zero Clause License
585 stars 116 forks source link

rhash -a -B not doing what I'd expect #260

Open berlincount opened 7 months ago

berlincount commented 7 months ago

Hi,

I'm taking note of file checksums before and after an operation, and was trying to optimize hashing algorithm choice.

I tried the following on my Ubuntu (package 1.4.2-1ubuntu1):

$ rhash -a -B
RHash v1.4.2 benchmarking...
 64 MiB calculated in 12.426 sec, 5.150 MBps
 64 MiB calculated in 13.018 sec, 4.916 MBps
 64 MiB calculated in 12.598 sec, 5.080 MBps
 64 MiB calculated in 12.531 sec, 5.107 MBps

with the github version being similar:

$ LD_LIBRARY_PATH=librhash ./rhash -a -B
RHash v1.4.4 benchmarking...
 64 MiB calculated in 13.376 sec, 4.785 MBps
 64 MiB calculated in 14.624 sec, 4.376 MBps
 64 MiB calculated in 13.320 sec, 4.805 MBps
 64 MiB calculated in 13.585 sec, 4.711 MBps
 256 MiB total in 54.905 sec, 4.663 MBps, CPB=517.72

... my expections might have been wrong here, but ... I'd have expected a list of comparable hash algorithm speeds here?

Additionally, --list-hashes doesn't really provide a list that I can then use for scriping such a comparison benchmark easily.

this did almost what I wanted:

$ for ALG in crc32 md5 tiger sha1 sha256 sha512; do rhash --$ALG -B ; done
RHash v1.4.2 benchmarking...
CRC32 512 MiB calculated in 0.309 sec, 1654.650 MBps
CRC32 512 MiB calculated in 0.309 sec, 1657.280 MBps
CRC32 512 MiB calculated in 0.319 sec, 1605.761 MBps
CRC32 512 MiB calculated in 0.310 sec, 1651.070 MBps
CRC32 2048 MiB total in 1.247 sec, 1641.914 MBps, CPB=1.49
RHash v1.4.2 benchmarking...
MD5 512 MiB calculated in 0.885 sec, 578.610 MBps
MD5 512 MiB calculated in 0.892 sec, 574.087 MBps
MD5 512 MiB calculated in 0.860 sec, 595.169 MBps
MD5 512 MiB calculated in 0.870 sec, 588.350 MBps
MD5 2048 MiB total in 3.507 sec, 583.938 MBps, CPB=4.13
RHash v1.4.2 benchmarking...
TIGER 512 MiB calculated in 0.928 sec, 552.004 MBps
TIGER 512 MiB calculated in 0.964 sec, 531.313 MBps
TIGER 512 MiB calculated in 0.935 sec, 547.604 MBps
TIGER 512 MiB calculated in 0.932 sec, 549.464 MBps
TIGER 2048 MiB total in 3.758 sec, 544.974 MBps, CPB=4.38
RHash v1.4.2 benchmarking...
SHA1 512 MiB calculated in 0.639 sec, 801.704 MBps
SHA1 512 MiB calculated in 0.612 sec, 836.245 MBps
SHA1 512 MiB calculated in 0.636 sec, 805.619 MBps
SHA1 512 MiB calculated in 0.610 sec, 839.343 MBps
SHA1 2048 MiB total in 2.496 sec, 820.369 MBps, CPB=2.89
RHash v1.4.2 benchmarking...
SHA-256 512 MiB calculated in 1.362 sec, 375.955 MBps
SHA-256 512 MiB calculated in 1.365 sec, 375.040 MBps
SHA-256 512 MiB calculated in 1.375 sec, 372.482 MBps
SHA-256 512 MiB calculated in 1.387 sec, 369.216 MBps
SHA-256 2048 MiB total in 5.488 sec, 373.155 MBps, CPB=6.37
RHash v1.4.2 benchmarking...
SHA-512 256 MiB calculated in 0.453 sec, 565.538 MBps
SHA-512 256 MiB calculated in 0.475 sec, 538.944 MBps
SHA-512 256 MiB calculated in 0.455 sec, 562.984 MBps
SHA-512 256 MiB calculated in 0.470 sec, 544.843 MBps
SHA-512 1024 MiB total in 1.852 sec, 552.841 MBps, CPB=4.26

thanks for this great software, maybe this input helps support uncommon usecases better :)

cheers,

count

rhash commented 4 weeks ago

You suggest another behavior of the --benchmark option, but it can be useful to keep ability to test perfomance of calculating several hashes at once (as it works now).

We need to name somehow an option to choose between the sugested behavior and the old one.