summaryrefslogtreecommitdiff
path: root/ext/hash/tests/murmurhash3_seed.phpt
blob: 68cc10a71935abb287e52f07c503589a10915da7 (plain)
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
--TEST--
Hash: MurmurHash3 seed
--FILE--
<?php

$ctx = hash_init("murmur3f", options: ["seed" => 42]);
hash_update($ctx, "Two");
hash_update($ctx, " hashes");
hash_update($ctx, " meet");
hash_update($ctx, " in");
hash_update($ctx, " a");
hash_update($ctx, " bar.");
$h0 = hash_final($ctx);
echo $h0, "\n";

$h0 = hash("murmur3f", "Two hashes meet in a bar.", options: ["seed" => 42]);
echo $h0, "\n";

$ctx = hash_init("murmur3c", options: ["seed" => 106]);
hash_update($ctx, "Two");
hash_update($ctx, " hashes");
hash_update($ctx, " meet");
hash_update($ctx, " in");
hash_update($ctx, " a");
hash_update($ctx, " bar.");
$h0 = hash_final($ctx);
echo $h0, "\n";

$h0 = hash("murmur3c", "Two hashes meet in a bar.", options: ["seed" => 106]);
echo $h0, "\n";

$ctx = hash_init("murmur3a", options: ["seed" => 2345]);
hash_update($ctx, "Two");
hash_update($ctx, " hashes");
hash_update($ctx, " meet");
hash_update($ctx, " in");
hash_update($ctx, " a");
hash_update($ctx, " bar.");
$h0 = hash_final($ctx);
echo $h0, "\n";

$h0 = hash("murmur3a", "Two hashes meet in a bar.", options: ["seed" => 2345]);
echo $h0, "\n";

?>
--EXPECT--
95855f9be0db784a5c37e878c4a4dcee
95855f9be0db784a5c37e878c4a4dcee
f64c9eb40287fa686575163893e283b2
f64c9eb40287fa686575163893e283b2
7f7ec59b
7f7ec59b