xref: /PHP-8.2/ext/hash/tests/joaat.phpt (revision f8d79582)
1--TEST--
2Hash: Jenkins's one-at-a-time
3--FILE--
4<?php
5$tests = array(
6    array("hello world", "3e4a5a57"),
7    array("", 0),
8    array("", "000000"),
9    array("a", "ca2e9442"),
10    array("aa", "7081738e"),
11);
12
13$i = 0;
14$pass = true;
15
16foreach ($tests as $test) {
17    ++$i;
18
19    $result = hash("joaat", $test[0]);
20    if ($result != $test[1]) {
21        echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
22
23        $pass = false;
24    }
25}
26
27if($pass) {
28    echo "PASS";
29}
30?>
31--EXPECT--
32PASS
33