$ docker run --rm --name validator-libsodium-usage-r-cran-sodium-pwhash-deterministic-2732 -t --mount type=bind,src=/tmp/validator-status-libsodium-usage-r-cran-sodium-pwhash-deterministic,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-r-cran-sodium-pwhash-deterministic -- bash -c 'PS4=$1; shift; set -x; source "$@"' validator-xtrace '__VALIDATOR_XTRACE__ ' /validator/tests/libsodium/tests/cases/usage/usage-r-cran-sodium-pwhash-deterministic.sh no override packages found; continuing with apt originals suppressMessages(library(sodium)) salt <- as.raw(rep(0x33, 32)) password <- "r sodium pwhash payload" key_a <- scrypt(charToRaw(password), salt = salt, size = 32) stopifnot(is.raw(key_a)) stopifnot(length(key_a) == 32) key_b <- scrypt(charToRaw(password), salt = salt, size = 32) stopifnot(identical(key_a, key_b)) # Different password under the same salt must change the digest. key_other_pw <- scrypt(charToRaw("different password"), salt = salt, size = 32) stopifnot(!identical(key_a, key_other_pw)) # Different salt under the same password must change the digest. salt_other <- as.raw(rep(0x44, 32)) key_other_salt <- scrypt(charToRaw(password), salt = salt_other, size = 32) stopifnot(!identical(key_a, key_other_salt)) # A different requested size produces a different-length digest. key_64 <- scrypt(charToRaw(password), salt = salt, size = 64) stopifnot(length(key_64) == 64) cat("ok", length(key_a), length(key_64), "\n") ' ok 32 64