$ docker run --rm --name validator-libsodium-usage-r-cran-sodium-bin2hex-roundtrip-2732 -t --mount type=bind,src=/tmp/validator-status-libsodium-usage-r-cran-sodium-bin2hex-roundtrip,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-bin2hex-roundtrip -- bash -c 'PS4=$1; shift; set -x; source "$@"' validator-xtrace '__VALIDATOR_XTRACE__ ' /validator/tests/libsodium/tests/cases/usage/usage-r-cran-sodium-bin2hex-roundtrip.sh no override packages found; continuing with apt originals suppressMessages(library(sodium)) sk <- keygen() stopifnot(is.raw(sk)) stopifnot(length(sk) == 32) hex_str <- bin2hex(sk) stopifnot(is.character(hex_str)) stopifnot(nchar(hex_str) == 64) stopifnot(grepl("^[0-9a-f]{64}$", hex_str)) decoded <- hex2bin(hex_str) stopifnot(is.raw(decoded)) stopifnot(length(decoded) == 32) stopifnot(identical(decoded, sk)) # Roundtripping a fixed value matches a known hex string exactly. fixed <- as.raw(c(0x00, 0xff, 0x10, 0x20, 0x30)) stopifnot(identical(bin2hex(fixed), "00ff102030")) stopifnot(identical(hex2bin("00ff102030"), fixed)) cat("ok", nchar(hex_str), "\n") ' ok 64