Skip to content

Commit c6d3c68

Browse files
committed
UPGRADING: Document algorithm specific hash options [ci skip]
Signed-off-by: Anatol Belski <ab@php.net>
1 parent 110b4e9 commit c6d3c68

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

UPGRADING

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,29 @@ PHP 8.1 UPGRADE NOTES
2424
========================================
2525

2626
- hash:
27-
. Added MurmurHash3 with streaming support. The following variants are implemented
27+
. The following functions have changed signatures:
28+
29+
- function hash(string $algo, string $data, bool $binary = false, array $options = []): string|false {}
30+
- function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}
31+
- function hash_init(string $algo, int $flags = 0, string $key = "", array $options = []): HashContext {}
32+
33+
The additional `$options` argument can be used to pass algorithm specific data.
34+
35+
. Added MurmurHash3 with streaming support. The following variants are implemented:
2836

2937
- murmur3a, 32-bit hash
3038
- murmur3c, 128-bit hash for x86
3139
- murmur3f, 128-bit hash for x64
3240

41+
The initial hash state can be passed through the `seed` key in the `$options` array, for example:
42+
43+
```php
44+
$h = hash("murmur3f", $data, options: ["seed" => 42]);
45+
echo $h, "\n";
46+
```
47+
48+
A valid seed value is within the range from 0 to the plaform defined UINT_MAX, usually 4294967295.
49+
3350
========================================
3451
3. Changes in SAPI modules
3552
========================================

0 commit comments

Comments
 (0)