/
hash.php
70 lines (53 loc) · 1.29 KB
/
hash.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Created by PhpStorm.
* User: ovr
* Date: 06.12.15
* Time: 22:26
*/
use Lavoiesl\PhpBenchmark\Benchmark;
use Ovr\Bench\AssignOrNot\ReturnAfterAssignProperty;
use Ovr\Bench\AssignOrNot\ReturnWithoutAfterAssignProperty;
include_once __DIR__ . '/vendor/autoload.php';
$benchmark = new Benchmark;
$benchmark->add('md5', function() {
md5("test");
});
$benchmark->add('sha1', function() {
sha1("test");
});
$benchmark->add('sha256', function() {
hash("sha256", "test");
});
$benchmark->add('sha384', function() {
hash("sha384", "test");
});
$benchmark->add('sha512', function() {
hash("sha512", "test");
});
$benchmark->add('haval128,3', function() {
hash("haval128,3", "test");
});
$benchmark->add('haval160,3', function() {
hash("haval160,3", "test");
});
$benchmark->add('haval192,3', function() {
hash("haval192,3", "test");
});
$benchmark->add('haval224,3', function() {
hash("haval224,3", "test");
});
$benchmark->add('haval256,3', function() {
hash("haval256,3", "test");
});
$benchmark->add('haval256,5', function() {
hash("haval256,5", "test");
});
$benchmark->add('whirlpool', function() {
hash("whirlpool", "test");
});
$benchmark->add('gost', function() {
hash("gost", "test");
});
$benchmark->setCount(1000000);
$benchmark->run();