$ docker run --rm --name validator-libsodium-usage-php83-r15-secretbox-different-nonces-distinct-ct-2732 -t --mount type=bind,src=/tmp/validator-status-libsodium-usage-php83-r15-secretbox-different-nonces-distinct-ct,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-r15-secretbox-different-nonces-distinct-ct -- bash -c 'PS4=$1; shift; set -x; source "$@"' validator-xtrace '__VALIDATOR_XTRACE__ ' /validator/tests/libsodium/tests/cases/usage/usage-php83-r15-secretbox-different-nonces-distinct-ct.sh no override packages found; continuing with apt originals $key = str_repeat("\x15", SODIUM_CRYPTO_SECRETBOX_KEYBYTES); $nonce_a = str_repeat("\x01", SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); $nonce_b = str_repeat("\x02", SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); $plain = "r15 php secretbox payload"; $ct_a = sodium_crypto_secretbox($plain, $nonce_a, $key); $ct_b = sodium_crypto_secretbox($plain, $nonce_b, $key); $expected_len = strlen($plain) + SODIUM_CRYPTO_SECRETBOX_MACBYTES; if (strlen($ct_a) !== $expected_len) { fwrite(STDERR, "ct_a len " . strlen($ct_a) . "\n"); exit(1); } if (strlen($ct_b) !== $expected_len) { fwrite(STDERR, "ct_b len " . strlen($ct_b) . "\n"); exit(1); } if ($ct_a === $ct_b) { fwrite(STDERR, "distinct nonces produced identical ciphertext\n"); exit(1); } $pt_a = sodium_crypto_secretbox_open($ct_a, $nonce_a, $key); $pt_b = sodium_crypto_secretbox_open($ct_b, $nonce_b, $key); if ($pt_a !== $plain) { fwrite(STDERR, "ct_a roundtrip mismatch\n"); exit(1); } if ($pt_b !== $plain) { fwrite(STDERR, "ct_b roundtrip mismatch\n"); exit(1); } echo "ok ", strlen($ct_a), PHP_EOL; ' ok 41