I'm not sure why $crc should be very close to $md5's speed, because everything I read gives the idea that CRC32 should be 3-5x faster than MD5. Since I find 2 copies of the bytes of the crc-32 lookup table in a hex viewer, it shouldn't be caused by $crc using the slower method that doesn't use the lookup table. Only other reason I can think for $crc being slower would be a routine that's called for each byte instead of called once for a long string.

It seems the benchmark comparisons between the speed of hashes depends on which pc is running them. The 1st one is from my PC, and the 2nd is a slower pc running win10.

crc: 1263 binvar size: 536870912
md5: 1326 is 104.988124%
sha1: 2449 is 193.903405%
sha256: 6911 is 547.189232%
sha384: 11217 is 888.123515%
sha512: 10982 is 869.517023%

crc: 1547 binvar size: 536870912
md5: 1766 is 114.156432%
sha1: 2203 is 142.404654%
sha256: 4109 is 265.61086%
sha384: 3469 is 224.240465%
sha512: 3484 is 225.210084%

The thing that's strange is how the SHA* all got faster. SHA512 is supposed to be slower than SHA256, but the win10 pc was actually running

This alias tries to eliminate as many types of overhead as possible, beyond just hashing the data. I had it hash the binvar once before timing it, in case there was a time delay in allocating the binvar in the first place. By using a very long binvar, I hoped to avoid time delays caused by repeatedly allocating string space, or lag from reading files from disk.

alias hash_speeds {
  bset &v $calc(2^$iif($1 isnum 1-,$1,29)) 1 | noop $crc(&v,1)
  var %t $ticks | noop    $crc(&v,1) | var  %crc   $calc($ticks - %t) | echo -a    crc:  %crc binvar size: $bvar(&v,0)
  var %t $ticks | noop    $md5(&v,1) | var  %md5   $calc($ticks - %t) | echo -a    md5:  %md5   is $calc(100 * %md5    /%crc) $+ %
  var %t $ticks | noop   $sha1(&v,1) | var %sha1   $calc($ticks - %t) | echo -a   sha1: %sha1   is $calc(100 * %sha1   /%crc) $+ %
  var %t $ticks | noop $sha256(&v,1) | var %sha256 $calc($ticks - %t) | echo -a sha256: %sha256 is $calc(100 * %sha256 /%crc) $+ %
  var %t $ticks | noop $sha384(&v,1) | var %sha384 $calc($ticks - %t) | echo -a sha384: %sha384 is $calc(100 * %sha384 /%crc) $+ %
  var %t $ticks | noop $sha512(&v,1) | var %sha512 $calc($ticks - %t) | echo -a sha512: %sha512 is $calc(100 * %sha512 /%crc) $+ %