1 | <?php |
||
8 | class Hash |
||
9 | { |
||
10 | /** |
||
11 | * Calculate Sha256(RipeMd160()) on the given data |
||
12 | * |
||
13 | * @param BufferInterface $data |
||
14 | * @return BufferInterface |
||
15 | */ |
||
16 | 592 | public static function sha256ripe160(BufferInterface $data) |
|
20 | |||
21 | /** |
||
22 | * Perform SHA256 |
||
23 | * |
||
24 | * @param BufferInterface $data |
||
25 | * @return BufferInterface |
||
26 | */ |
||
27 | 408 | public static function sha256(BufferInterface $data) |
|
31 | |||
32 | /** |
||
33 | * Perform SHA256 twice |
||
34 | * |
||
35 | * @param BufferInterface $data |
||
36 | * @return BufferInterface |
||
37 | */ |
||
38 | 4090 | public static function sha256d(BufferInterface $data) |
|
42 | |||
43 | /** |
||
44 | * RIPEMD160 |
||
45 | * |
||
46 | * @param BufferInterface $data |
||
47 | * @return BufferInterface |
||
48 | */ |
||
49 | 16 | public static function ripemd160(BufferInterface $data) |
|
53 | |||
54 | /** |
||
55 | * RIPEMD160 twice |
||
56 | * |
||
57 | * @param BufferInterface $data |
||
58 | * @return BufferInterface |
||
59 | */ |
||
60 | 6 | public static function ripemd160d(BufferInterface $data) |
|
64 | |||
65 | /** |
||
66 | * Calculate a SHA1 hash |
||
67 | * |
||
68 | * @param BufferInterface $data |
||
69 | * @return BufferInterface |
||
70 | */ |
||
71 | 18 | public static function sha1(BufferInterface $data) |
|
75 | |||
76 | /** |
||
77 | * PBKDF2 |
||
78 | * |
||
79 | * @param string $algorithm |
||
80 | * @param BufferInterface $password |
||
81 | * @param BufferInterface $salt |
||
82 | * @param integer $count |
||
83 | * @param integer $keyLength |
||
84 | * @return BufferInterface |
||
85 | * @throws \Exception |
||
86 | */ |
||
87 | 162 | public static function pbkdf2($algorithm, BufferInterface $password, BufferInterface $salt, $count, $keyLength) |
|
105 | |||
106 | /** |
||
107 | 78 | * @param BufferInterface $data |
|
108 | * @param int $seed |
||
109 | 78 | * @return BufferInterface |
|
110 | */ |
||
111 | public static function murmur3(BufferInterface $data, $seed) |
||
115 | |||
116 | /** |
||
117 | * Do HMAC hashing on $data and $salt |
||
118 | * |
||
119 | * @param string $algo |
||
120 | 66 | * @param BufferInterface $data |
|
121 | * @param BufferInterface $salt |
||
122 | 66 | * @return BufferInterface |
|
123 | */ |
||
124 | public static function hmac($algo, BufferInterface $data, BufferInterface $salt) |
||
128 | } |
||
129 |