1 개요[ | ]
- 해시 함수 속도 비교
- 해시 알고리즘 속도 비교
- 해시 알고리즘들의 속도를 비교하기 위해 20만회씩 실행시키고 걸린 시간을 측정하였다.
2 소스 코드[ | ]
PHP
Copy
<?php
function get_time() {
return microtime(true);
}
$algos = ['md2','md4','md5','sha1','sha256','sha384','sha512',
'ripemd128','ripemd160','ripemd256','ripemd320','whirlpool',
'tiger128,3','tiger160,3','tiger192,3','tiger128,4','tiger160,4','tiger192,4',
'snefru','gost','adler32','crc32','crc32b',
'haval128,3','haval160,3','haval192,3','haval224,3','haval256,3','haval128,4',
'haval160,4','haval192,4','haval224,4','haval256,4','haval128,5','haval160,5',
'haval192,5','haval224,5','haval256,5'];
echo "알고리즘\t수행시간\t값길이\t해시값\n";
foreach($algos as $algo) {
$start = get_time();
for($i=0;$i<200000;$i++) {
$hash_value = hash($algo, '다람쥐 헌 쳇바퀴 타고파');
}
$end = get_time();
$time = $end - $start;
echo $algo."\t";
echo number_format($time,5)."\t";
echo strlen($hash_value)."\t";
echo $hash_value."\n";
}
Loading
3 비교 결과[ | ]
수행시간 오름차순
순위 | 알고리즘 | 수행시간 (초) | 길이 | 해시 값 예시 |
---|---|---|---|---|
1 | crc32b | 0.17888 | 8 | 590d4e4b |
2 | crc32 | 0.19157 | 8 | 91d5837a |
3 | md4 | 0.21683 | 32 | 18eccd1cddee900df0c8fc55bf94d390 |
4 | adler32 | 0.23199 | 8 | 69156f6e |
5 | md5 | 0.25052 | 32 | 993ba8e67013ddf822d8d18d45443110 |
6 | tiger128,3 | 0.25292 | 32 | 7509999da305d6a1cb079aa91bd865d2 |
7 | tiger160,3 | 0.25597 | 40 | 7509999da305d6a1cb079aa91bd865d2e204bd0f |
8 | tiger192,3 | 0.26382 | 48 | 7509999da305d6a1cb079aa91bd865d2e204bd0f00c4ddf6 |
9 | sha1 | 0.26618 | 40 | 7b0b11296dfa758f63e91db05ed4d9f72b58c578 |
10 | tiger128,4 | 0.28568 | 32 | bea6f95169816fe46ab41833ed71fdf3 |
11 | tiger160,4 | 0.28739 | 40 | bea6f95169816fe46ab41833ed71fdf30e2a730b |
12 | tiger192,4 | 0.29094 | 48 | bea6f95169816fe46ab41833ed71fdf30e2a730b8144b654 |
13 | ripemd128 | 0.34877 | 32 | 7cd47221e5eaebe045b8523eef3e8e43 |
14 | ripemd256 | 0.36446 | 64 | 0f16dd91f998b661ce3681a56e47b2a3ba093cbed5a4f0dc1913305cd6ffc256 |
15 | ripemd160 | 0.41295 | 40 | 5a501f9c761e610c62a625ac8d079582e0a8e878 |
16 | sha256 | 0.42983 | 64 | 6c216eee540504941185cd0386eeb4a44f300ecae3fd3700dab0719e98301908 |
17 | ripemd320 | 0.44928 | 80 | 08b086c8e8bc42732a682849a81ea2ca4ec2ac04a1ab7f8d4cf7a7c665a4b5d73e4710ef9fa4204a |
18 | sha384 | 0.51008 | 96 | a747bb05453dd7ced555f0e9ca81b69f05950367ec88c3bfd60c4439b523f4a84db6921719f97ab3c6baadb7b0ee8ef4 |
19 | haval128,3 | 0.51404 | 32 | 59f242fc95f4b20fbc0406ffe064554e |
20 | sha512 | 0.52009 | 128 | 0e55e69e4ff2c2d1a4b643fc2433dbda6fe4e7eb571a9f57c164c1ededf6b4ce9adae6c8a0c0ce1a408d7d9c95afc35dd9c61b48e261dc29298186f50ba64d13 |
21 | haval256,3 | 0.52471 | 64 | 3b4b02ed86f53a6e41105b28258a3cb5d3a7f9174561b3221215667717fa6deb |
22 | haval192,3 | 0.52506 | 48 | 915ea379646e5cf913a0dc99497577457979e1b58f01eae6 |
23 | haval224,3 | 0.52591 | 56 | 44e50942e7c266c5c7aa30959ca3604258aac93ea226e27995f95df5 |
24 | haval160,3 | 0.52788 | 40 | 2bed4e71819b173bfc34782987738ad221d901ec |
25 | haval160,4 | 0.61706 | 40 | 79ce3d9ea93cdf353d6bc580eb9ddfd5d62c91b9 |
26 | haval192,4 | 0.62014 | 48 | c80c60a9eba6e80099e707d813eef426d84c84d0d2ef50d0 |
27 | haval128,4 | 0.62194 | 32 | 45abde6a6e2855d922737748bfd008a4 |
28 | haval224,4 | 0.6233 | 56 | b686e575b67f438837962491fa8b8a7e6149ab46d3e47fcc6b7fe097 |
29 | haval256,4 | 0.62871 | 64 | 610d76fa1544a8c50dbc30298bc993741be0e8b5a58526aa91afbfec3f6850db |
30 | haval256,5 | 0.7001 | 64 | 62d3888c4a20748be0a0f1bebcc2187dd37aa319474a6db32cd23603da47cf1b |
31 | haval128,5 | 0.71733 | 32 | cf4889155db5abcb059fcfbd7c5963a1 |
32 | haval160,5 | 0.72231 | 40 | 9b444ac7ff5ee9ebcc96b3f9332c0df545e7a2a6 |
33 | haval192,5 | 0.72236 | 48 | 475b3cf46307c9348187da5ab2c70d9fad4127aaf62a5aac |
34 | haval224,5 | 0.72414 | 56 | e53d73c37c6619ea259544636befb59f40629509bf0a9dcdbb346737 |
35 | whirlpool | 1.1002 | 128 | 4fc9e309ee64101c6f9b7f9121bd147689dcef0097a64c05357ba9ac6b4bdeac0f7129ec265e1e439c077bc748740f9a6501d39a7f0085a49df641dd635f6f39 |
36 | gost | 1.29657 | 64 | 39172b05b1759d5c4dbda5d717e58aa0577cd519f2ae2b0b7b9cb29fcb0c5e35 |
37 | snefru | 2.00746 | 64 | 63f16b2b59dbc5c8306dc64fbd77cc18f62d912342b59a27f0164f40e3001807 |
38 | md2 | 3.01494 | 32 | 91ec72722b20f18ef2b0f8e58e81d44a |
4 같이 보기[ | ]
5 참고[ | ]
편집자 Jmnote 104.28.211.29
로그인하시면 댓글을 쓸 수 있습니다.