$ docker run --rm --name validator-libsodium-usage-php83-r18-generichash-distinct-keys-distinct-outputs-2732 -t --mount type=bind,src=/tmp/validator-status-libsodium-usage-php83-r18-generichash-distinct-keys-distinct-outputs,dst=/validator/status validator-libsodium-shared bash -lc 'set -euo pipefail /validator/tests/_shared/install_override_debs.sh exec /validator/tests/_shared/run_library_tests.sh "$@"' validator-testcase libsodium usage-php83-r18-generichash-distinct-keys-distinct-outputs -- bash -c 'PS4=$1; shift; set -x; source "$@"' validator-xtrace '__VALIDATOR_XTRACE__ ' /validator/tests/libsodium/tests/cases/usage/usage-php83-r18-generichash-distinct-keys-distinct-outputs.sh no override packages found; continuing with apt originals $msg = "r18 php generichash keyed payload"; $k1 = random_bytes(SODIUM_CRYPTO_GENERICHASH_KEYBYTES); $k2 = random_bytes(SODIUM_CRYPTO_GENERICHASH_KEYBYTES); $h1 = sodium_crypto_generichash($msg, $k1); $h2 = sodium_crypto_generichash($msg, $k2); $h1b = sodium_crypto_generichash($msg, $k1); if (strlen($h1) !== 32) { fwrite(STDERR, "len h1=" . strlen($h1) . "\n"); exit(1); } if (strlen($h2) !== 32) { fwrite(STDERR, "len h2=" . strlen($h2) . "\n"); exit(1); } if ($h1 === $h2) { fwrite(STDERR, "distinct keys collided\n"); exit(1); } if ($h1 !== $h1b) { fwrite(STDERR, "same key not deterministic\n"); exit(1); } echo "ok keyed_generichash len=", strlen($h1), PHP_EOL; ' ok keyed_generichash len=32