xref: /PHP-8.1/ext/hash/tests/xxhash_seed.phpt (revision 23590f7c)
1--TEST--
2Hash: xxHash seed
3--FILE--
4<?php
5
6foreach (["xxh32", "xxh64", "xxh3", "xxh128"] as $a) {
7
8	$ctx = hash_init($a, options: ["seed" => 42]);
9	hash_update($ctx, "Lorem");
10	hash_update($ctx, " ipsum dolor");
11	hash_update($ctx, " sit amet,");
12	hash_update($ctx, " consectetur adipiscing elit.");
13	$h0 = hash_final($ctx);
14	echo $h0, "\n";
15
16	$h0 = hash($a, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", options: ["seed" => 42]);
17	echo $h0, "\n";
18}
19
20?>
21--EXPECT--
223d0cc7e5
233d0cc7e5
249c9aa071b5d22a15
259c9aa071b5d22a15
26366409913c16b70d
27366409913c16b70d
28f87856a7589354e92aeca886c71ed7fb
29f87856a7589354e92aeca886c71ed7fb
30