Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-crypto

Source of release 0.6.1

0.6.1 / tests / oracles / main.luc

# The drivers under drivers/ against independent oracles: NIST and generated SHA-2 corpora
# and file streams, HMAC/HKDF, BLAKE2b and H', Argon2id against Python's hashlib/hmac and
# the pinned RFC 9106 fixture, and ML-DSA-65 against OpenSSL. Each driver is a program the
# Python harness feeds batches of cases (oracles.py); `luc test` runs this with LUCE_BASE
# naming the compiler that builds them.
from luce_std import files, paths, process

let failed = ErrorCode.package(1)

pub func main(arguments: list[str]) -> int!:
    let top = process.current_directory()
    let here = process.variable("LUC_TEST_DIR") else error(failed, "LUC_TEST_DIR names no test directory")
    let base = process.variable("LUCE_BASE") else "luce-base"
    let binaries = paths.join(top, "build/tests/oracles/drivers")
    files.ensure_directory(binaries)
    for name in ["hash", "file", "keyed", "blake2b", "argon2", "mldsa_interop"]:
        let built = process.run(base, ["build", paths.join(here, f"drivers/{name}.lucb"), "--native", "-o", paths.join(binaries, name)], here)
        if built.exit_code != 0:
            error(failed, f"build {name}: {built.output}{built.error_output}")
    let ran = process.run("python3", ["oracles.py", binaries], here)
    print(ran.output)
    if ran.exit_code != 0:
        print(ran.error_output)
        return 1
    return 0