Schulung, Beratung und Entwicklung

Glück IT

Gesellschaft für IT Beratung, Schulung und Entwicklung

NEWS

Content Management System ®CMAssist

MD5, CRC32, SH1. Welcher ist der schnellste HASH Algorithmus?

42 Hash Algorithmen in PHP im vergleich

echo '<pre>';

$run = array();

function test($algo)
{
  #static $c = 0;
  #if($c>10) return;
  #$c++;

 $tss = microtime(true);
 for($i=0; $i<100000; $i++){
  $x = hash($algo, "ana are mere");
 }
 $tse = microtime(true);

 $GLOBALS['run'][(string)round($tse-$tss, 5)] = "\nhash({$algo}): \t".round($tse-$tss, 5) . " \t" . $x;
 #echo "\n$i nhash({$algo}): \t".round($tse-$tss, 5) . " \t" . $x;
}
array_map('test', hash_algos());
ksort($run);
print_r($run);
echo '</pre>';

GesamtzeitHASH AlgorithmusZeitBeispiel
[0.059]hash(adler32)0.0591b8c0452
[0.06077]hash(fnv132)0.06077715ad4bc
[0.0611]hash(joaat)0.061133cc7c85
[0.0616]hash(crc32)0.0616da927cb8
[0.06263]hash(crc32b)0.062632f9bcea7
[0.06519]hash(fnv164)0.0651959ffa43dbef2d47c
[0.08458]hash(md4)0.084585c97ff8102022ef95f0d2ac2ee5931be
[0.09071]hash(md5)0.090710dbab6d0c841278d33be207f14eeab8b
[0.09598]hash(sha1)0.09598417a9e5c9ac7c52e32727cfd25da99eca9339a80
[0.10416]hash(tiger128,3)0.10416e345f85932ef35aa71c40c4f69956279
[0.1057]hash(tiger160,3)0.1057e345f85932ef35aa71c40c4f69956279fcf630c7
[0.10755]hash(tiger192,3)0.10755e345f85932ef35aa71c40c4f69956279fcf630c77f399f9b
[0.11115]hash(ripemd128)0.11115bbc5b0f9f0e94b640d9dcdf4182af0a2
[0.11213]hash(tiger128,4)0.112134a540bb82cd367d55a94358e61aef1e8
[0.1149]hash(tiger160,4)0.11494a540bb82cd367d55a94358e61aef1e8b9402256
[0.11563]hash(tiger192,4)0.115634a540bb82cd367d55a94358e61aef1e8b94022567b1bb996
[0.11812]hash(ripemd256)0.118127192b71fe27b92133ce45b346074b6e6ba441dc53302707c5bd9a1e1053b4c62
[0.13223]hash(ripemd160)0.132239ebec759a458748cbeaeae6b24a34af3691dc58f
[0.14173]hash(ripemd320)0.141738cef90854b47a6981076d08cf404646dd82f4b644b84b57f25378dc5f25faab7496b5aa0c03c060e
[0.15486]hash(sha224)0.15486dc6151d530ea6b9cfe1f9f92004d74954d16f3c2b5adaac9da5ef1a1
[0.16382]hash(sha256)0.16382a3b5ac0c302d9cb2a0ae1efbff61c609953d63466d6ac62609dd030448a83607
[0.1867]hash(haval128,3)0.1867f12d6dd715ea8b69eadbfe24fc45bad7
[0.18833]hash(sha384)0.1883318072b1a667321af845b0c6ae857d812231b1880331a1fc9b945c7f675338be2b1efffde940b54472c011af3f4107fd5
[0.18885]hash(haval160,3)0.18885cb917d0e9254138c542077b2605923f5e02a3f8f
[0.18937]hash(haval192,3)0.1893727c5af95f395df9784c40341063aa815661294b946317b64
[0.19144]hash(haval224,3)0.19144c17d9769ff1ea6478c31c33c6f77e745b5db57a17c72fca9247aed47
[0.19166]hash(haval256,3)0.19166d160f1b9ff47a9c8b6bd855884cd7e79566639a439c04330e765b9f40d13e710
[0.19362]hash(sha512)0.1936222f42d154c64335d489915c3af4db3d93eeefa7d855791715dfee0dfcfe48f24d574c0da9a0c307a6b6639d3dfa581326f0cd01b4ead97b36341d5566c1e41c5
[0.23718]hash(whirlpool)0.23718564da7b68af6a206ea2768cf4cc41a0792e1ce1eadb2fae6520831ee2a784b99b2ecac28f2934078a1afe28bd2f3c51d3a5fe4e7e1fefe8230239c44beb793ef
[0.23902]hash(haval128,4)0.23902ec2885f6a15362cc920fe2410edb805f
[0.23934]hash(haval192,4)0.23934871c28a4f419e1362ae306f7fe2afa702ce7ebadbe26da67
[0.24012]hash(haval160,4)0.240121d0564972a591294bf0a1a9531b506a18370dc1c
[0.242]hash(haval224,4)0.242717190b14fbd5a6cd0652368d0faff127712ae8630995b470f6fd84b
[0.24297]hash(haval256,4)0.24297e632570bfddec9ce9cd205d98e934c47c87283081725d4e3617569f962105991
[0.26902]hash(haval128,5)0.26902f28391b32dab65fcb95d0fa9f9280b01
[0.27094]hash(haval160,5)0.27094d9284229fcddd4061cac7c4503953c1a97423f89
[0.272]hash(haval192,5)0.272027be2a7be8904c1335a4ad18051d06843570549de10627a
[0.27435]hash(haval256,5)0.27435d36637bf77236dbd5f61f7e4c4ddb18e264f4e77b611a52b51717e1f82d432b0
[0.28168]hash(haval224,5)0.281688ffb85b3d5246e60b48f618d351e81344b407f6ca032709def6d373f
[0.36944]hash(gost)0.36944fd486f5672a697564b4df0db000347dbc715b6e866a4f56b094aa6bb8cae8fb7
[0.50135]hash(snefru)0.501357ee4ac32d344140326ff8e6ac4848ccfc3de6ed1eaef11f2cac3c2ea78a24a04
[0.50554]hash(snefru256)0.505547ee4ac32d344140326ff8e6ac4848ccfc3de6ed1eaef11f2cac3c2ea78a24a04
[0.55282]hash(md2)0.5528223d50c75a061b9f423c5206339d71bd4