[php-src] Issue #10305: xxh3 hash ignores seed if string?
| From: | lolli42 | Date: | Thu, 12 Jan 2023 22:22:58 +0000 |
| Subject: | [php-src] Issue #10305: xxh3 hash ignores seed if string? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243429@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10305
Author: lolli42
### Description
The following code:
```php
<?php
var_dump(hash('xxh3', 'foo'));
# same hash?
var_dump(hash('xxh3', 'foo', options: ['seed' =>
'mySeed']));
# different hash!
var_dump(hash('xxh3', 'foo', options: ['seed' => 42]));
```
Resulted in this output:
```
string(16) "ab6e5f64077e7d8a"
string(16) "ab6e5f64077e7d8a"
string(16) "d33da54e20ebf99e"
```
I'd expect the second hash to be different from the first one, just like the third hash. It
seems a string as 'seed' is ignored. In case this is intended, it might be good to
document this, or maybe except on string input?
### PHP Version
8.1.13
### Operating System
ubuntu20.04.1+deb.sury.org+1