Skip to content
Systems programming for what’s next.
— Vex

std::crypto API Reference ​

Development snapshot. Generated from the current repository source. This inventory may include internal and test declarations; it is not a list of supported public APIs. Check the module guide and the compiler version you use before relying on an entry.

Application entry points ​

Start with checked cryptographic facades, AEAD ownership and nonce policy, hashes, and key derivation/signatures. export marks a declaration in its defining source module; it does not classify a raw kernel or test helper as an application-level facade.

Overview ​

Structs: ChaCha20Poly1305 · Aes128Gcm · Aes256Gcm · HkdfSha256 · HkdfSha384 · Pbkdf2Sha256 · X25519 · Ed25519 · Argon2Parameters · Argon2id · CryptoError · ExtPoint · AffPoint · Fe25519 · Poly1305 · Sha1 · Sha256 · Sha512 · Sha384

Enums: CryptoErrorKind

Contracts: Digest32 · Mac32

Functions: computeAeadTag · aeadEncrypt · aeadDecrypt · xtime · gfMul8 · gfPow8 · rotl8 · sboxByte · rconAt · aes256ExpandKey · aes128ExpandKey · aesEncryptBlockWithRk · aes128EncryptBlockWithRk · aes128EncryptBlock · aes256EncryptBlockWithRk · aes256EncryptBlock · counter32be · inc32be · validateIncrementingCtrRequest · validateInitialCtrRequest · aes256CtrXorWithRk · aes256CtrXor · aes128CtrXorWithRk · aes128CtrXor · aes128CtrXorFromInitialCounter · reverseBits64 · ghashMulReflected · ghashUpdateReflected · ghashBlockReflected · ghashUpdateFourReflected · ghashAll · encryptBlockWithSchedule · ctrXorWithSchedule · validateGcmLengths · gcmEncryptWithSchedule · gcmDecryptWithSchedule · aes128GcmEncrypt · aes128GcmDecrypt · aes256GcmEncrypt · aes256GcmDecrypt · cryptoError · clearSensitiveOutput · validateExactLength · spansOverlapOutput · checkedTaggedLength · prepareDetachedInputs · aesGcmSealDetachedInto · aesGcmOpenDetachedInto · loadLe64 · low32 · rotr64 · add64 · blamka · storeLe64 · storeLe32 · roundedMemoryKiB · validParams · clearOutputIfRepresentable · invalidArgonParameter · hash2ToLen · hPrimeTo · blockOffset · gbMix · roundBlockInPlace · fillBlock · nextAddressBlock · selectRefIndex · seedInitBlock · argon2DeriveVariant · argon2DeriveVariantEx · argon2idDerive · argon2idDeriveEx · argon2iDerive · argon2iDeriveEx · argon2dDerive · argon2dDeriveEx · clearArgonVec · argonSpanOverlapsOutput · validateArgonFacade · b64At · base64Encode · base64EncodeString · rotr64 · loadLe64 · storeLe64 · ivAt · sigmaRow · g · compress · blake2bTo · blake2bHex · ctEq · xorInto · xorInPlace · zeroize · rotl32 · loadLe32 · storeLe32 · quarterRound · chacha20Block · chacha20Xor · loadLe32 · rotl32 · qr · pack64 · chacha20Block4Way · pointIdentity · edD · ed2D · affIdentity · affBasepoint · affAdd · affScalarMul · feCopyAff · affEncode · feEq · fePowConst · feSqrtM1 · feSqrtRatio · scalarLessThanL · affDecodeCompressed · affToExt · pointDouble · pointAdd · pointCopy · pointCmov · ctEqNibble · scalarMul · extIsIdentity · extHasSmallOrder · pointEncode · basepointExt · scalarL · reduceModL64 · mulScalar32 · scMulAdd · scReduce · ed25519PublicKey · ed25519Sign · ed25519SignHex · ed25519Verify · ed25519PublicKeyHex · ed25519BasepointHex · ed25519MulBaseHex · feLoadLe64 · feZero · feOne · feCopy · feFromBytes · feToBytes · feCarryPropagate · feReduce · feAdd · feSub · feReduceWide · feMul · feMulSmall · feSq · feSqN · feInvert · feCSwap · hexChar · fromHexNibble · hexEncode · hexDecodeTo · hkdfExtract · hkdfExpand · hkdf · hkdfExtractSha384 · hkdfExpandSha384 · hkdfSha384 · hmacSha1To · hmacSha256To · hmacSha256PartsTo · hmacSha384PartsTo · hmacSha384To · hmacSha384Hex · hmacSha256Hex · hmacVerifySha256Hex · pbkdf2Sha256 · pbkdf2Sha256Hex · p1305LoadLe32 · newPoly1305 · poly1305Auth · rol32 · newSha1 · sha1To · sha1Hex · bswap32 · k256 · newSha256 · sha256To · sha256Hex · rotr64 · ch512 · maj512 · bsig0_512 · bsig1_512 · ssig0_512 · ssig1_512 · bswap64 · k512 · sha512Hex · sha512To · sha384Hex · sha384To · xorBlocks · addU32Blocks · rotrU32Blocks · storeLe64 · storeBe64 · x25519 · x25519Basepoint · x25519Hex · test_aead_rfc8439 · test_aead_tamper_reject · test_aes128_fips197_block_vector · test_aes128_gcm_nist_zero_vector · test_aes_gcm_roundtrip · test_aes_gcm_reject_tamper · test_aes_ctr_rejects_counter_wrap_before_output · test_aes_ctr_initial_counter_allows_final_block · test_aes_gcm_rejects_oversized_payload_before_output · arraySpan · strBytes · assertBytes · test_safe_chacha_combined_roundtrip_and_reuse · test_safe_aes256_gcm_combined_roundtrip · test_safe_aes128_gcm_combined_roundtrip_and_dimensions · test_safe_facade_rejects_dimensions_and_clears_output · test_safe_facade_auth_failure_releases_no_plaintext · test_safe_facade_stages_in_place_aliases · test_safe_hkdf_rfc5869_and_reuse · test_safe_hkdf_sha384_reuse_and_failure_clearing · test_safe_pbkdf2_vector_and_parameter_error · test_safe_argon2id_reuse_alias_and_parameter_errors · test_safe_argon2id_accepts_empty_password · test_safe_ed25519_roundtrip_and_dimensions · expectArgonSuccess · test_argon2id_deterministic · test_argon2id_param_sensitivity · test_argon2_variants_produce_distinct_outputs · test_argon2_invalid_params_zero_output · test_argon2id_ex_secret_ad_affect_output · test_argon2i_d_ex_secret_ad_affect_output · test_argon2id_long_output_deterministic · test_argon2id_rfc9106_case · makeBytes · observe · bench_sha256_4k · bench_chacha20_poly1305_seal_16k · bench_chacha20_xor_16k · bench_poly1305_auth_16k · bench_aes128_gcm_seal_16k · bench_aes256_gcm_seal_16k · bench_x25519_public_key · bench_ed25519_sign_1k · bench_ed25519_verify_1k · bench_argon2id_1mib_one_pass · test_blake2b_empty · test_blake2b_abc · test_cteq_basic · test_xor_and_zeroize · fillSeq · test_chacha20_block_rfc8439 · test_chacha20_xor_roundtrip · test_chacha20_four_way_matches_scalar_blocks · test_chacha20_rejects_counter_wrap_before_output · main · test_ed25519_public_key_rfc8032_case1 · test_ed25519_sign_rfc8032_case1 · test_ed25519_verify_rfc8032_case1 · test_ed25519_verify_reject_tamper · identityForgerySignature · test_ed25519_verify_rejects_small_order_public_key · test_ed25519_verify_rejects_noncanonical_point_encoding · fillFieldInput · fieldEqual · test_field25519_wide_mul_and_square_properties · test_field25519_inversion_identity · test_hex_encode_decode_roundtrip · test_hex_decode_invalid · test_hkdf_sha384_extract_and_multiblock_expand · test_hkdf_sha384_rejects_oversized_output_before_write · test_hkdf_extract_rfc5869 · test_hkdf_expand_rfc5869 · test_hkdf_rejects_oversized_output_before_write · test_hmac_sha384_rfc4231_case1 · test_hmac_sha1_rfc2202_case2 · test_hmac_sha256_key_data · test_hmac_verify · test_pbkdf2_rfc6070_1 · test_pbkdf2_rfc6070_2 · test_pbkdf2_rejects_zero_iterations_before_write · assertTagEq · test_poly1305_empty · test_poly1305_rfc7539 · test_poly1305_rfc8439_a3 · test_poly1305_streaming_partitions_match_one_shot · test_sha256_empty · test_sha256_abc · test_sha256_snapshot_does_not_finalize_state · test_sha384_empty · test_sha384_abc · test_sha384_snapshot_does_not_finalize_state · test_sha512_empty · test_sha512_abc · test_sha512_check · xSpan · test_x25519_rfc7748 · test_x25519_basepoint_bob · test_safe_x25519_agreement · test_safe_x25519_rejects_non_contributory_peer · test_x25519_caller_owned_to_api_is_allocation_free_and_exact · test_x25519_to_api_rejects_alias_and_zeroes_low_order_output

Constants: MASK32 · MASK64 · ARGON2D_VARIANT · ARGON2I_VARIANT · ARGON2ID_VARIANT · ARGON2_VERSION_13 · ARGON2_BLOCK_BYTES · K256 · shiftLe · shiftBe

Constants ​

MASK32 ​

📄 argon2id.vx L7-7

vex
const MASK32: u64=0xffffffff;

MASK64 ​

📄 argon2id.vx L8-8

vex
const MASK64: u64=0xffffffffffffffff;

ARGON2D_VARIANT ​

📄 argon2id.vx L215-215

vex
const ARGON2D_VARIANT: u8=0;

ARGON2I_VARIANT ​

📄 argon2id.vx L216-216

vex
const ARGON2I_VARIANT: u8=1;

ARGON2ID_VARIANT ​

📄 argon2id.vx L217-217

vex
const ARGON2ID_VARIANT: u8=2;

ARGON2_VERSION_13 ​

📄 argon2id.vx L218-218

vex
const ARGON2_VERSION_13: u64=0x13;

ARGON2_BLOCK_BYTES ​

📄 argon2id.vx L219-219

vex
const ARGON2_BLOCK_BYTES: i64=1024;

K256 ​

📄 sha256.vx L8-25

vex
const K256: [u32; 64]=[
    0x428a2f98 as u32, 0x71374491 as u32, 0xb5c0fbcf as u32, 0xe9b5dba5 as u32,
    0x3956c25b as u32, 0x59f111f1 as u32, 0x923f82a4 as u32, 0xab1c5ed5 as u32,
    0xd807aa98 as u32, 0x12835b01 as u32, 0x243185be as u32, 0x550c7dc3 as u32,
    0x72be5d74 as u32, 0x80deb1fe as u32, 0x9bdc06a7 as u32, 0xc19bf174 as u32,
    0xe49b69c1 as u32, 0xefbe4786 as u32, 0x0fc19dc6 as u32, 0x240ca1cc as u32,
    0x2de92c6f as u32, 0x4a7484aa as u32, 0x5cb0a9dc as u32, 0x76f988da as u32,
    0x983e5152 as u32, 0xa831c66d as u32, 0xb00327c8 as u32, 0xbf597fc7 as u32,
    0xc6e00bf3 as u32, 0xd5a79147 as u32, 0x06ca6351 as u32, 0x14292967 as u32,
    0x27b70a85 as u32, 0x2e1b2138 as u32, 0x4d2c6dfc as u32, 0x53380d13 as u32,
    0x650a7354 as u32, 0x766a0abb as u32, 0x81c2c92e as u32, 0x92722c85 as u32,
    0xa2bfe8a1 as u32, 0xa81a664b as u32, 0xc24b8b70 as u32, 0xc76c51a3 as u32,
    0xd192e819 as u32, 0xd6990624 as u32, 0xf40e3585 as u32, 0x106aa070 as u32,
    0x19a4c116 as u32, 0x1e376c08 as u32, 0x2748774c as u32, 0x34b0bcb5 as u32,
    0x391c0cb3 as u32, 0x4ed8aa4a as u32, 0x5b9cca4f as u32, 0x682e6ff3 as u32,
    0x748f82ee as u32, 0x78a5636f as u32, 0x84c87814 as u32, 0x8cc70208 as u32,
    0x90befffa as u32, 0xa4506ceb as u32, 0xbef9a3f7 as u32, 0xc67178f2 as u32,
];

shiftLe ​

📄 utils.vx L2-2

vex
const shiftLe: [u8;8]=[0,8,16,24,32,40,48,56];

shiftBe ​

📄 utils.vx L3-3

vex
const shiftBe: [u8;8]=[56,48,40,32,24,16,8,0];

Contracts ​

Digest32 ​

📄 contracts.vx L48-53

vex
export contract Digest32 {
    reset()!;
    update(data: str)!;
    updateRaw(data: RawBuf, len: u64)!;
    sum(out: Ptr<u8>, out_len: u64)!;
}

Methods:

MethodSignatureDescription
reset↗reset()!;
update↗update(data: str)!;
updateRaw↗updateRaw(data: RawBuf, len: u64)!;
sum↗sum(out: Ptr<u8>, out_len: u64)!;

Mac32 ​

📄 contracts.vx L55-60

vex
export contract Mac32 {
    reset()!;
    update(data: str)!;
    updateRaw(data: RawBuf, len: u64)!;
    final(out: Ptr<u8>, out_len: u64)!;
}

Methods:

MethodSignatureDescription
reset↗reset()!;
update↗update(data: str)!;
updateRaw↗updateRaw(data: RawBuf, len: u64)!;
final↗final(out: Ptr<u8>, out_len: u64)!;

Structs ​

ChaCha20Poly1305 🔓 export ​

📄 api.vx L19-19

vex
export struct ChaCha20Poly1305

Methods:

MethodSignatureDescription
ChaCha20Poly1305.sealDetachedInto↗export fn ChaCha20Poly1305.sealDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>Encrypt into caller-reusable storage and return a detached 128-bit tag.
ChaCha20Poly1305.openDetachedInto↗export fn ChaCha20Poly1305.openDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>Authenticate before releasing plaintext into caller-reusable storage.
ChaCha20Poly1305.sealInto↗export fn ChaCha20Poly1305.sealInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>Encrypt to the conventional ciphertext || tag representation.
ChaCha20Poly1305.openInto↗export fn ChaCha20Poly1305.openInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>Open a conventional ciphertext || tag value.
ChaCha20Poly1305.seal↗export fn ChaCha20Poly1305.seal(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>): Result<Vec<u8>, CryptoError>
ChaCha20Poly1305.open↗export fn ChaCha20Poly1305.open(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>): Result<Vec<u8>, CryptoError>

Aes128Gcm 🔓 export ​

📄 api.vx L20-20

vex
export struct Aes128Gcm

Methods:

MethodSignatureDescription
Aes128Gcm.sealDetachedInto↗export fn Aes128Gcm.sealDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>AES-128-GCM detached encryption for protocols such as TLS 1.3.
Aes128Gcm.openDetachedInto↗export fn Aes128Gcm.openDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>
Aes128Gcm.sealInto↗export fn Aes128Gcm.sealInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>
Aes128Gcm.openInto↗export fn Aes128Gcm.openInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>
Aes128Gcm.seal↗export fn Aes128Gcm.seal(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>): Result<Vec<u8>, CryptoError>
Aes128Gcm.open↗export fn Aes128Gcm.open(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>): Result<Vec<u8>, CryptoError>

Aes256Gcm 🔓 export ​

📄 api.vx L21-21

vex
export struct Aes256Gcm

Methods:

MethodSignatureDescription
Aes256Gcm.sealDetachedInto↗export fn Aes256Gcm.sealDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>AES-256-GCM detached encryption with the checked/reusable contract.
Aes256Gcm.openDetachedInto↗export fn Aes256Gcm.openDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>
Aes256Gcm.sealInto↗export fn Aes256Gcm.sealInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>
Aes256Gcm.openInto↗export fn Aes256Gcm.openInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>
Aes256Gcm.seal↗export fn Aes256Gcm.seal(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>): Result<Vec<u8>, CryptoError>
Aes256Gcm.open↗export fn Aes256Gcm.open(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>): Result<Vec<u8>, CryptoError>

HkdfSha256 🔓 export ​

📄 api.vx L22-22

vex
export struct HkdfSha256

Methods:

MethodSignatureDescription
HkdfSha256.extract↗export fn HkdfSha256.extract(salt: Span<u8>, inputKeyMaterial: Span<u8>): Result<[u8; 32], CryptoError>Extract a fixed 32-byte pseudorandom key without exposing raw pointers.
HkdfSha256.expandInto↗export fn HkdfSha256.expandInto(prk: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>Expand a 32-byte PRK into caller-reusable storage. RFC 5869's 8160-byte
HkdfSha256.deriveInto↗export fn HkdfSha256.deriveInto(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>One-shot HKDF-SHA256 derivation into caller-reusable storage.
HkdfSha256.derive↗export fn HkdfSha256.derive(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize): Result<Vec<u8>, CryptoError>

HkdfSha384 🔓 export ​

📄 api.vx L23-23

vex
export struct HkdfSha384

Methods:

MethodSignatureDescription
HkdfSha384.extract↗export fn HkdfSha384.extract(salt: Span<u8>, inputKeyMaterial: Span<u8>): Result<[u8; 48], CryptoError>Extract a fixed 48-byte SHA-384 pseudorandom key through safe spans.
HkdfSha384.expandInto↗export fn HkdfSha384.expandInto(prk: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>Expand a 48-byte PRK into caller-reusable storage. RFC 5869's 12240-byte
HkdfSha384.deriveInto↗export fn HkdfSha384.deriveInto(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>
HkdfSha384.derive↗export fn HkdfSha384.derive(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize): Result<Vec<u8>, CryptoError>

Pbkdf2Sha256 🔓 export ​

📄 api.vx L24-24

vex
export struct Pbkdf2Sha256

Methods:

MethodSignatureDescription
Pbkdf2Sha256.deriveInto↗export fn Pbkdf2Sha256.deriveInto(password: Span<u8>, salt: Span<u8>, iterations: u64, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>PBKDF2-HMAC-SHA256 into reusable storage. Iteration count and RFC output
Pbkdf2Sha256.derive↗export fn Pbkdf2Sha256.derive(password: Span<u8>, salt: Span<u8>, iterations: u64, outputLength: usize): Result<Vec<u8>, CryptoError>

X25519 🔓 export ​

📄 api.vx L25-25

vex
export struct X25519

Methods:

MethodSignatureDescription
X25519.publicKeyTo↗export fn X25519.publicKeyTo(privateKey: Span<u8>, output: &Span<u8>!): Result<usize, CryptoError>Derive an X25519 public key from an exact 32-byte private scalar.
X25519.publicKeyInto↗export fn X25519.publicKeyInto(privateKey: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>Derive an X25519 public key into reusable owned storage.
X25519.publicKey↗export fn X25519.publicKey(privateKey: Span<u8>): Result<[u8; 32], CryptoError>
X25519.sharedSecretTo↗export fn X25519.sharedSecretTo(privateKey: Span<u8>, peerPublicKey: Span<u8>, output: &Span<u8>!): Result<usize, CryptoError>Compute a contributory X25519 shared secret. RFC 7748 permits callers to
X25519.sharedSecretInto↗export fn X25519.sharedSecretInto(privateKey: Span<u8>, peerPublicKey: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>Compute a contributory X25519 shared secret into reusable owned storage.
X25519.sharedSecret↗export fn X25519.sharedSecret(privateKey: Span<u8>, peerPublicKey: Span<u8>): Result<[u8; 32], CryptoError>

Ed25519 🔓 export ​

📄 api.vx L26-26

vex
export struct Ed25519

Methods:

MethodSignatureDescription
Ed25519.publicKey↗export fn Ed25519.publicKey(privateSeed: Span<u8>): Result<[u8; 32], CryptoError>Derive the RFC 8032 public key for an exact 32-byte private seed.
Ed25519.signInto↗export fn Ed25519.signInto(privateSeed: Span<u8>, message: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>Deterministically sign a message into caller-reusable storage. The private
Ed25519.sign↗export fn Ed25519.sign(privateSeed: Span<u8>, message: Span<u8>): Result<[u8; 64], CryptoError>
Ed25519.verify↗export fn Ed25519.verify(publicKey: Span<u8>, message: Span<u8>, signature: Span<u8>): Result<bool, CryptoError>Strict verification: canonical encodings, canonical S, and non-small-order

Argon2Parameters 🔓 export ​

📄 argon2id.vx L755-760

vex
export struct Argon2Parameters

Public Argon2 cost policy. Memory is expressed in KiB, matching RFC 9106.

Implements: Copy

Fields:

NameTypeAccess
timeCostu64🔓 public
memoryKiBu64🔓 public
parallelismu64🔓 public

Methods:

MethodSignatureDescription
Argon2Parameters.new↗export fn Argon2Parameters.new(timeCost: u64, memoryKiB: u64, parallelism: u64): Argon2Parameters
Argon2Parameters.recommended↗export fn Argon2Parameters.recommended(): Argon2ParametersRFC 9106's memory-constrained recommendation: 64 MiB, three passes and

Argon2id 🔓 export ​

📄 argon2id.vx L783-783

vex
export struct Argon2id

Type-safe Argon2id facade. RawBuf kernels remain available for protocol

implementations, while application code should use this Span/Vec surface.

Methods:

MethodSignatureDescription
Argon2id.deriveInto↗export fn Argon2id.deriveInto(password: Span<u8>, salt: Span<u8>, parameters: Argon2Parameters, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>Derive into caller-reusable storage. Input/output aliases are staged before
Argon2id.deriveExInto↗export fn Argon2id.deriveExInto(password: Span<u8>, salt: Span<u8>, secret: Span<u8>, associatedData: Span<u8>, parameters: Argon2Parameters, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>RFC 9106 extended derivation with an optional secret (pepper) and
Argon2id.derive↗export fn Argon2id.derive(password: Span<u8>, salt: Span<u8>, parameters: Argon2Parameters, outputLength: usize): Result<Vec<u8>, CryptoError>
Argon2id.deriveEx↗export fn Argon2id.deriveEx(password: Span<u8>, salt: Span<u8>, secret: Span<u8>, associatedData: Span<u8>, parameters: Argon2Parameters, outputLength: usize): Result<Vec<u8>, CryptoError>

CryptoError 🔓 export ​

📄 contracts.vx L18-23

vex
export struct CryptoError

Allocation-free cryptographic operation failure. requested and limit

are byte counts unless the operation documents another unit.

Implements: Copy

Fields:

NameTypeAccess
kindCryptoErrorKind🔓 public
requestedu64🔓 public
limitu64🔓 public

Methods:

MethodSignatureDescription
CryptoError.new↗export fn CryptoError.new(kind: CryptoErrorKind, requested: u64, limit: u64): CryptoError
message↗export fn (self: &CryptoError) message(): str

ExtPoint ​

📄 ed25519.vx L12-18

vex
struct ExtPoint

Implements: Copy

Fields:

NameTypeAccess
xFe25519🔓 public
yFe25519🔓 public
zFe25519🔓 public
tFe25519🔓 public

AffPoint ​

📄 ed25519.vx L52-56

vex
struct AffPoint

Fields:

NameTypeAccess
xFe25519🔓 public
yFe25519🔓 public

Fe25519 🔓 export ​

📄 field25519.vx L10-13

vex
export struct Fe25519

Field element in 5x51-bit limbs

Implements: Copy

Fields:

NameTypeAccess
l[u64; 5]🔓 public

Poly1305 🔓 export ​

📄 poly1305.vx L10-18

vex
export struct Poly1305

Fields:

NameTypeAccess
r[u32; 5]🔒 private
rs[u32; 4]🔒 private
h[u32; 5]🔒 private
pad[u32; 4]🔒 private
buf[u8; 16]🔒 private
buf_lenusize🔒 private
finalizedbool🔒 private

Methods:

MethodSignatureDescription
Poly1305.new↗export fn Poly1305.new(key: RawBuf, key_len: usize): Poly1305
update↗export fn (self: &Poly1305!) update(data: RawBuf, len: usize)
processBufferedBlock↗fn (self: &Poly1305!) processBufferedBlock(hibit: u32)
processDataBlock↗fn (self: &Poly1305!) processDataBlock(data: RawBuf, offset: usize)
processWords↗fn (self: &Poly1305!) processWords(t0: u32, t1: u32, t2: u32, t3: u32, hibit: u32)
finalize↗export fn (self: &Poly1305!) finalize(): [u8; 16]

Sha1 🔓 export ​

📄 sha1.vx L7-12

vex
export struct Sha1

Fields:

NameTypeAccess
h[u32; 5]🔒 private
buf[u8; 64]🔒 private
bufLenu64🔒 private
totalLenu64🔒 private

Methods:

MethodSignatureDescription
Sha1.new↗export fn Sha1.new(): Sha1
processBlock↗fn (self: &Sha1!) processBlock(block: RawBuf)
reset↗export fn (self: &Sha1!) reset()!
update↗export fn (self: &Sha1!) update(data: str)
updateRaw↗export fn (self: &Sha1!) updateRaw(data: RawBuf, len: u64)
sum↗export fn (self: &Sha1!) sum(out: Ptr<u8>, out_len: u64)!

Sha256 🔓 export ​

📄 sha256.vx L34-39

vex
export struct Sha256

Fields:

NameTypeAccess
h[u32; 8]🔒 private
buf[u8; 64]🔒 private
bufLenu64🔒 private
totalLenu64🔒 private

Methods:

MethodSignatureDescription
Sha256.new↗export fn Sha256.new(): Sha256
processBlock↗fn (self: &Sha256!) processBlock(block: RawBuf, offset: usize)
reset↗export fn (self: &Sha256!) reset()!
update↗export fn (self: &Sha256!) update(data: str)
updateRaw↗export fn (self: &Sha256!) updateRaw(data: RawBuf, len: u64)
sum↗export fn (self: &Sha256!) sum(out: Ptr<u8>, out_len: u64)!
snapshotTo↗export fn (self: &Sha256) snapshotTo(out: Ptr<u8>, outLen: u64): boolWrites the digest of the current state without consuming or finalizing it.

Sha512 🔓 export ​

📄 sha512.vx L65-71

vex
export struct Sha512

Fields:

NameTypeAccess
h[u64; 8]🔓 public
buf[u8; 128]🔓 public
bufLenu64🔓 public
totalLenu64🔓 public

Methods:

MethodSignatureDescription
Sha512.new↗export fn Sha512.new(): Sha512
init↗export fn (self: &Sha512!) init()
init384↗fn (self: &Sha512!) init384()
processBlock512↗fn (self: &Sha512!) processBlock512(block: RawBuf, offset: usize)
update512↗export fn (self: &Sha512!) update512(data: str)
updateRaw512↗export fn (self: &Sha512!) updateRaw512(data: RawBuf, len: u64)
sum512Family↗fn (self: &Sha512!) sum512Family(out: Ptr<u8>, outLen: u64, digestLen: u64)
sum512↗export fn (self: &Sha512!) sum512(out: Ptr<u8>, outLen: u64)

Sha384 🔓 export ​

📄 sha512.vx L77-79

vex
export struct Sha384

SHA-384 shares SHA-512's compression function and block size, but uses

the independent FIPS 180-4 initial state and truncates the digest to 48 bytes. Keeping a single Sha512 engine avoids a second cryptographic kernel drifting away from the standard.

Fields:

NameTypeAccess
stateSha512🔒 private

Methods:

MethodSignatureDescription
Sha384.new↗export fn Sha384.new(): Sha384
update384↗export fn (self: &Sha384!) update384(data: str)
updateRaw384↗export fn (self: &Sha384!) updateRaw384(data: RawBuf, len: u64)
sum384↗export fn (self: &Sha384!) sum384(out: Ptr<u8>, outLen: u64)
reset384↗export fn (self: &Sha384!) reset384()Resets a SHA-384 state to its FIPS 180-4 initial value.
snapshotTo↗export fn (self: &Sha384) snapshotTo(out: Ptr<u8>, outLen: u64): boolWrites the digest of the current state without consuming or finalizing it.

Enums ​

CryptoErrorKind 🔓 export ​

📄 contracts.vx L3-14

vex
export enum CryptoErrorKind

Variants:

  • InvalidKeyLength
  • InvalidNonceLength
  • InvalidTagLength
  • InvalidSignatureLength
  • MessageTooLarge
  • CounterExhausted
  • AuthenticationFailed
  • InvalidPublicKey
  • InvalidParameter
  • OutOfMemory

Functions ​

computeAeadTag ​

📄 aead.vx L10-46

vex
fn computeAeadTag(otkBuf: RawBuf, aad: RawBuf, aadLen: u64, ct: RawBuf, ctLen: u64): [u8; 16]

Parameters:

NameType
otkBufRawBuf
aadRawBuf
aadLenu64
ctRawBuf
ctLenu64

Returns: [u8; 16]


aeadEncrypt 🔓 export ​

📄 aead.vx L52-81

vex
export fn aeadEncrypt(key: RawBuf, nonce: RawBuf, aad: RawBuf, aadLen: u64, plaintext: RawBuf, ptLen: u64, out: RawBuf): Result<[u8; 16], CryptoError>

Encrypt with ChaCha20-Poly1305 AEAD (RFC 8439).

key: 32 bytes, nonce: 12 bytes. Writes ciphertext to out (same length as plaintext). Returns 16-byte authentication tag.

Parameters:

NameType
keyRawBuf
nonceRawBuf
aadRawBuf
aadLenu64
plaintextRawBuf
ptLenu64
outRawBuf

Returns: Result<[u8; 16], CryptoError>


aeadDecrypt 🔓 export ​

📄 aead.vx L87-123

vex
export fn aeadDecrypt(key: RawBuf, nonce: RawBuf, aad: RawBuf, aadLen: u64, ciphertext: RawBuf, ctLen: u64, tag: RawBuf, out: RawBuf): Result<(), CryptoError>

Decrypt with ChaCha20-Poly1305 AEAD (RFC 8439).

key: 32 bytes, nonce: 12 bytes. Returns Ok(()) after authentication and decryption, or a typed CryptoError. Authentication failure clears ctLen output bytes. The early oversized-AAD error returns before touching output; do not infer that every error clears it. This raw API cannot validate allocation extents: callers must supply the exact readable/writable byte ranges below and uphold aliasing requirements. Prefer the checked ChaCha20Poly1305 facade for application records.

Parameters:

NameTypeDescription
keyRawBuf32 readable key bytes
nonceRawBuf12 readable nonce bytes; unique per key/encryption
aadRawBufaadLen readable associated-data bytes
aadLenu64Associated-data length in bytes
ciphertextRawBufctLen readable ciphertext bytes
ctLenu64Ciphertext/output length in bytes; excludes the tag
tagRawBuf16 readable authentication-tag bytes
outRawBufAt least ctLen writable bytes

Returns: Result<(), CryptoError>


xtime ​

📄 aes.vx L5-8

vex
fn xtime(x: u8): u8

Parameters:

NameType
xu8

Returns: u8


gfMul8 ​

📄 aes.vx L10-24

vex
fn gfMul8(a: u8, b: u8): u8

Parameters:

NameType
au8
bu8

Returns: u8


gfPow8 ​

📄 aes.vx L26-39

vex
fn gfPow8(a: u8, exp: u32): u8

Parameters:

NameType
au8
expu32

Returns: u8


rotl8 ​

📄 aes.vx L41-43

vex
fn rotl8(x: u8, n: u8): u8

Parameters:

NameType
xu8
nu8

Returns: u8


sboxByte ​

📄 aes.vx L45-50

vex
fn sboxByte(x: u8): u8

Parameters:

NameType
xu8

Returns: u8


rconAt ​

📄 aes.vx L52-60

vex
fn rconAt(iter: i64): u8

Parameters:

NameType
iteri64

Returns: u8


aes256ExpandKey 🔓 export ​

📄 aes.vx L64-113

vex
export fn aes256ExpandKey(key: RawBuf): [u8; 240]

Expand an AES-256 key once for internal multi-block constructions.

Callers must securely erase the returned 240-byte schedule.

Parameters:

NameType
keyRawBuf

Returns: [u8; 240]


aes128ExpandKey 🔓 export ​

📄 aes.vx L120-157

vex
export fn aes128ExpandKey(key: RawBuf): [u8; 176]

Expand an AES-128 key once for internal multi-block constructions.

Callers must securely erase the returned 176-byte schedule.

Parameters:

NameType
keyRawBuf

Returns: [u8; 176]


aesEncryptBlockWithRk ​

📄 aes.vx L159-173

vex
fn aesEncryptBlockWithRk(rkb: RawBuf, input: RawBuf, out: RawBuf, rounds: i64)

Parameters:

NameType
rkbRawBuf
inputRawBuf
outRawBuf
roundsi64

aes128EncryptBlockWithRk 🔓 export ​

📄 aes.vx L175-177

vex
export fn aes128EncryptBlockWithRk(rkb: RawBuf, input: RawBuf, out: RawBuf)

Parameters:

NameType
rkbRawBuf
inputRawBuf
outRawBuf

aes128EncryptBlock 🔓 export ​

📄 aes.vx L181-186

vex
export fn aes128EncryptBlock(key: RawBuf, input: RawBuf, out: RawBuf)

AES-128 encrypt one 16-byte block.

key: 16 bytes, input: 16 bytes.

Parameters:

NameType
keyRawBuf
inputRawBuf
outRawBuf

aes256EncryptBlockWithRk 🔓 export ​

📄 aes.vx L188-190

vex
export fn aes256EncryptBlockWithRk(rkb: RawBuf, input: RawBuf, out: RawBuf)

Parameters:

NameType
rkbRawBuf
inputRawBuf
outRawBuf

aes256EncryptBlock 🔓 export ​

📄 aes.vx L194-199

vex
export fn aes256EncryptBlock(key: RawBuf, input: RawBuf, out: RawBuf)

AES-256 encrypt one 16-byte block.

key: 32 bytes, input: 16 bytes.

Parameters:

NameType
keyRawBuf
inputRawBuf
outRawBuf

counter32be ​

📄 aes.vx L201-206

vex
fn counter32be(counterBlock: RawBuf): u32

Parameters:

NameType
counterBlockRawBuf

Returns: u32


inc32be ​

📄 aes.vx L208-221

vex
fn inc32be(counterBlock: RawBuf)

Parameters:

NameType
counterBlockRawBuf

validateIncrementingCtrRequest ​

📄 aes.vx L223-243

vex
fn validateIncrementingCtrRequest(counter0: RawBuf, len: u64): Result<(), CryptoError>

Parameters:

NameType
counter0RawBuf
lenu64

Returns: Result<(), CryptoError>


validateInitialCtrRequest ​

📄 aes.vx L248-266

vex
fn validateInitialCtrRequest(counter0: RawBuf, len: u64): Result<(), CryptoError>

Validate the variant whose supplied counter is encrypted before it is

incremented. This is distinct from the GCM/J0 helpers above: an initial value of u32::MAX still permits exactly one 16-byte block.

Parameters:

NameType
counter0RawBuf
lenu64

Returns: Result<(), CryptoError>


aes256CtrXorWithRk 🔓 export ​

📄 aes.vx L269-322

vex
export fn aes256CtrXorWithRk(rkb: RawBuf, counter0: RawBuf, input: RawBuf, len: u64, out: RawBuf): Result<(), CryptoError>

AES-256 CTR using a caller-owned expanded schedule.

Parameters:

NameType
rkbRawBuf
counter0RawBuf
inputRawBuf
lenu64
outRawBuf

Returns: Result<(), CryptoError>


aes256CtrXor 🔓 export ​

📄 aes.vx L326-338

vex
export fn aes256CtrXor(key: RawBuf, counter0: RawBuf, input: RawBuf, len: u64, out: RawBuf): Result<(), CryptoError>

AES-256 CTR XOR helper (counter block is 16-byte J0-like block).

Uses inc32 in big-endian per GCM convention.

Parameters:

NameType
keyRawBuf
counter0RawBuf
inputRawBuf
lenu64
outRawBuf

Returns: Result<(), CryptoError>


aes128CtrXorWithRk 🔓 export ​

📄 aes.vx L343-383

vex
export fn aes128CtrXorWithRk(rkb: RawBuf, counter0: RawBuf, input: RawBuf, len: u64, out: RawBuf): Result<(), CryptoError>

AES-128 CTR XOR helper (counter block is a 16-byte J0-like block).

Like AES-GCM's CTR construction, the supplied block is incremented before it is encrypted for the first segment.

Parameters:

NameType
rkbRawBuf
counter0RawBuf
inputRawBuf
lenu64
outRawBuf

Returns: Result<(), CryptoError>


aes128CtrXor 🔓 export ​

📄 aes.vx L385-393

vex
export fn aes128CtrXor(key: RawBuf, counter0: RawBuf, input: RawBuf, len: u64, out: RawBuf): Result<(), CryptoError>

Parameters:

NameType
keyRawBuf
counter0RawBuf
inputRawBuf
lenu64
outRawBuf

Returns: Result<(), CryptoError>


aes128CtrXorFromInitialCounter 🔓 export ​

📄 aes.vx L398-441

vex
export fn aes128CtrXorFromInitialCounter(key: RawBuf, counter0: RawBuf, input: RawBuf, len: u64, out: RawBuf)

Parameters:

NameType
keyRawBuf
counter0RawBuf
inputRawBuf
lenu64
outRawBuf

reverseBits64 ​

📄 aes_gcm.vx L9-17

vex
fn reverseBits64(value: u64): u64

Parameters:

NameType
valueu64

Returns: u64


ghashMulReflected ​

📄 aes_gcm.vx L19-42

vex
fn ghashMulReflected(xLo: u64, xHi: u64, hLo: u64, hHi: u64): [u64; 2]

Parameters:

NameType
xLou64
xHiu64
hLou64
hHiu64

Returns: [u64; 2]


ghashUpdateReflected ​

📄 aes_gcm.vx L44-55

vex
fn ghashUpdateReflected(yLo: u64, yHi: u64, hLo: u64, hHi: u64, block: RawBuf): [u64; 2]

Parameters:

NameType
yLou64
yHiu64
hLou64
hHiu64
blockRawBuf

Returns: [u64; 2]


ghashBlockReflected ​

📄 aes_gcm.vx L57-62

vex
fn ghashBlockReflected(block: RawBuf): [u64; 2]

Parameters:

NameType
blockRawBuf

Returns: [u64; 2]


ghashUpdateFourReflected ​

📄 aes_gcm.vx L64-93

vex
fn ghashUpdateFourReflected(yLo: u64, yHi: u64, hLo: u64, hHi: u64, h2Lo: u64, h2Hi: u64, h3Lo: u64, h3Hi: u64, h4Lo: u64, h4Hi: u64, blocks: RawBuf): [u64; 2]

Parameters:

NameType
yLou64
yHiu64
hLou64
hHiu64
h2Lou64
h2Hiu64
h3Lou64
h3Hiu64
h4Lou64
h4Hiu64
blocksRawBuf

Returns: [u64; 2]


ghashAll ​

📄 aes_gcm.vx L95-206

vex
fn ghashAll(h: RawBuf, aad: RawBuf, aadLen: u64, ct: RawBuf, ctLen: u64): [u8; 16]

Parameters:

NameType
hRawBuf
aadRawBuf
aadLenu64
ctRawBuf
ctLenu64

Returns: [u8; 16]


encryptBlockWithSchedule ​

📄 aes_gcm.vx L208-216

vex
fn encryptBlockWithSchedule(keyBytes: usize, roundKeys: RawBuf, input: RawBuf, output: RawBuf)

Parameters:

NameType
keyBytesusize
roundKeysRawBuf
inputRawBuf
outputRawBuf

ctrXorWithSchedule ​

📄 aes_gcm.vx L218-230

vex
fn ctrXorWithSchedule(keyBytes: usize, roundKeys: RawBuf, counter: RawBuf, input: RawBuf, length: u64, output: RawBuf): Result<(), CryptoError>

Parameters:

NameType
keyBytesusize
roundKeysRawBuf
counterRawBuf
inputRawBuf
lengthu64
outputRawBuf

Returns: Result<(), CryptoError>


validateGcmLengths ​

📄 aes_gcm.vx L232-261

vex
fn validateGcmLengths(aadLen: u64, textLen: u64): Result<(), CryptoError>

Parameters:

NameType
aadLenu64
textLenu64

Returns: Result<(), CryptoError>


gcmEncryptWithSchedule ​

📄 aes_gcm.vx L263-323

vex
fn gcmEncryptWithSchedule(keyBytes: usize, roundKeys: RawBuf, nonce12: RawBuf, aad: RawBuf, aadLen: u64, plaintext: RawBuf, ptLen: u64, out: RawBuf): Result<[u8; 16], CryptoError>

Parameters:

NameType
keyBytesusize
roundKeysRawBuf
nonce12RawBuf
aadRawBuf
aadLenu64
plaintextRawBuf
ptLenu64
outRawBuf

Returns: Result<[u8; 16], CryptoError>


gcmDecryptWithSchedule ​

📄 aes_gcm.vx L325-393

vex
fn gcmDecryptWithSchedule(keyBytes: usize, roundKeys: RawBuf, nonce12: RawBuf, aad: RawBuf, aadLen: u64, ciphertext: RawBuf, ctLen: u64, tag: RawBuf, out: RawBuf): Result<(), CryptoError>

Parameters:

NameType
keyBytesusize
roundKeysRawBuf
nonce12RawBuf
aadRawBuf
aadLenu64
ciphertextRawBuf
ctLenu64
tagRawBuf
outRawBuf

Returns: Result<(), CryptoError>


aes128GcmEncrypt 🔓 export ​

📄 aes_gcm.vx L396-409

vex
export fn aes128GcmEncrypt(key: RawBuf, nonce12: RawBuf, aad: RawBuf, aadLen: u64, plaintext: RawBuf, ptLen: u64, out: RawBuf): Result<[u8; 16], CryptoError>

AES-128-GCM encrypt with the NIST 96-bit nonce fast path.

Parameters:

NameType
keyRawBuf
nonce12RawBuf
aadRawBuf
aadLenu64
plaintextRawBuf
ptLenu64
outRawBuf

Returns: Result<[u8; 16], CryptoError>


aes128GcmDecrypt 🔓 export ​

📄 aes_gcm.vx L413-427

vex
export fn aes128GcmDecrypt(key: RawBuf, nonce12: RawBuf, aad: RawBuf, aadLen: u64, ciphertext: RawBuf, ctLen: u64, tag: RawBuf, out: RawBuf): Result<(), CryptoError>

AES-128-GCM authenticated decryption. Plaintext is released only after the

complete tag has been verified in constant time.

Parameters:

NameType
keyRawBuf
nonce12RawBuf
aadRawBuf
aadLenu64
ciphertextRawBuf
ctLenu64
tagRawBuf
outRawBuf

Returns: Result<(), CryptoError>


aes256GcmEncrypt 🔓 export ​

📄 aes_gcm.vx L430-443

vex
export fn aes256GcmEncrypt(key: RawBuf, nonce12: RawBuf, aad: RawBuf, aadLen: u64, plaintext: RawBuf, ptLen: u64, out: RawBuf): Result<[u8; 16], CryptoError>

AES-256-GCM encrypt with one key expansion per complete operation.

Parameters:

NameType
keyRawBuf
nonce12RawBuf
aadRawBuf
aadLenu64
plaintextRawBuf
ptLenu64
outRawBuf

Returns: Result<[u8; 16], CryptoError>


aes256GcmDecrypt 🔓 export ​

📄 aes_gcm.vx L445-459

vex
export fn aes256GcmDecrypt(key: RawBuf, nonce12: RawBuf, aad: RawBuf, aadLen: u64, ciphertext: RawBuf, ctLen: u64, tag: RawBuf, out: RawBuf): Result<(), CryptoError>

Parameters:

NameType
keyRawBuf
nonce12RawBuf
aadRawBuf
aadLenu64
ciphertextRawBuf
ctLenu64
tagRawBuf
outRawBuf

Returns: Result<(), CryptoError>


cryptoError ​

📄 api.vx L28-30

vex
fn cryptoError(kind: CryptoErrorKind, requested: usize, limit: usize): CryptoError

Parameters:

NameType
kindCryptoErrorKind
requestedusize
limitusize

Returns: CryptoError


clearSensitiveOutput ​

📄 api.vx L32-37

vex
fn clearSensitiveOutput(output: &Vec<u8>!)

Parameters:

NameType
output&Vec<u8>!

validateExactLength ​

📄 api.vx L39-50

vex
fn validateExactLength(actual: usize, expected: usize, kind: CryptoErrorKind, output: &Vec<u8>!): Result<(), CryptoError>

Parameters:

NameType
actualusize
expectedusize
kindCryptoErrorKind
output&Vec<u8>!

Returns: Result<(), CryptoError>


spansOverlapOutput ​

📄 api.vx L52-60

vex
fn spansOverlapOutput(source: Span<u8>, output: &Vec<u8>): bool

Parameters:

NameType
sourceSpan<u8>
output&Vec<u8>

Returns: bool


checkedTaggedLength ​

📄 api.vx L62-68

vex
fn checkedTaggedLength(length: usize, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
lengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


prepareDetachedInputs ​

📄 api.vx L70-89

vex
fn prepareDetachedInputs(key: Span<u8>, nonce: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<(), CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
tagSpan<u8>
output&Vec<u8>!

Returns: Result<(), CryptoError>


aesGcmSealDetachedInto ​

📄 api.vx L269-328

vex
fn aesGcmSealDetachedInto(keyLength: usize, useAes128: bool, key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>

Parameters:

NameType
keyLengthusize
useAes128bool
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>
output&Vec<u8>!

Returns: Result<[u8; 16], CryptoError>


aesGcmOpenDetachedInto ​

📄 api.vx L330-402

vex
fn aesGcmOpenDetachedInto(keyLength: usize, useAes128: bool, key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
keyLengthusize
useAes128bool
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
ciphertextSpan<u8>
tagSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


loadLe64 ​

📄 argon2id.vx L10-20

vex
fn loadLe64(buf: RawBuf, off: usize): u64

Parameters:

NameType
bufRawBuf
offusize

Returns: u64


low32 ​

📄 argon2id.vx L22-24

vex
fn low32(x: u64): u64

Parameters:

NameType
xu64

Returns: u64


rotr64 ​

📄 argon2id.vx L26-28

vex
fn rotr64(x: u64, n: u64): u64

Parameters:

NameType
xu64
nu64

Returns: u64


add64 ​

📄 argon2id.vx L30-32

vex
fn add64(a: u64, b: u64): u64

Parameters:

NameType
au64
bu64

Returns: u64


blamka ​

📄 argon2id.vx L34-37

vex
fn blamka(a: u64, b: u64): u64

Parameters:

NameType
au64
bu64

Returns: u64


storeLe64 ​

📄 argon2id.vx L39-48

vex
fn storeLe64(buf: RawBuf!, off: usize, v: u64)

Parameters:

NameType
bufRawBuf!
offusize
vu64

storeLe32 ​

📄 argon2id.vx L50-55

vex
fn storeLe32(buf: RawBuf!, off: usize, v: u32)

Parameters:

NameType
bufRawBuf!
offusize
vu32

roundedMemoryKiB ​

📄 argon2id.vx L57-60

vex
fn roundedMemoryKiB(memoryKiB: u64, parallelism: u64): u64

Parameters:

NameType
memoryKiBu64
parallelismu64

Returns: u64


validParams ​

📄 argon2id.vx L62-90

vex
fn validParams(pwdLen: u64, saltLen: u64, secretLen: u64, adLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, outLen: u64): bool

Parameters:

NameType
pwdLenu64
saltLenu64
secretLenu64
adLenu64
timeCostu64
memoryKiBu64
parallelismu64
outLenu64

Returns: bool


clearOutputIfRepresentable ​

📄 argon2id.vx L92-97

vex
fn clearOutputIfRepresentable(out: RawBuf!, outLen: u64)

Parameters:

NameType
outRawBuf!
outLenu64

invalidArgonParameter ​

📄 argon2id.vx L99-101

vex
fn invalidArgonParameter(requested: u64, limit: u64): Result<(), CryptoError>

Parameters:

NameType
requestedu64
limitu64

Returns: Result<(), CryptoError>


hash2ToLen ​

📄 argon2id.vx L103-123

vex
fn hash2ToLen(a: RawBuf, aLen: u64, b: RawBuf, bLen: u64, out: RawBuf, outLen: u64)

Parameters:

NameType
aRawBuf
aLenu64
bRawBuf
bLenu64
outRawBuf
outLenu64

hPrimeTo ​

📄 argon2id.vx L129-207

vex
fn hPrimeTo(input: RawBuf, inputLen: u64, out: RawBuf!, outLen: u64)

Parameters:

NameType
inputRawBuf
inputLenu64
outRawBuf!
outLenu64

blockOffset ​

📄 argon2id.vx L211-213

vex
fn blockOffset(idx: i64): usize

Algorithm indices remain signed for the reference-index arithmetic, but

all validated memory byte offsets cross into RawBuf as target-width usize.

Parameters:

NameType
idxi64

Returns: usize


gbMix ​

📄 argon2id.vx L221-243

vex
fn gbMix(v: RawBuf, a: i64, b: i64, c: i64, d: i64)

Parameters:

NameType
vRawBuf
ai64
bi64
ci64
di64

roundBlockInPlace ​

📄 argon2id.vx L245-293

vex
fn roundBlockInPlace(block: RawBuf)

Parameters:

NameType
blockRawBuf

fillBlock ​

📄 argon2id.vx L295-316

vex
fn fillBlock(prev: RawBuf, ref: RawBuf, next: RawBuf!, withXor: bool)

Parameters:

NameType
prevRawBuf
refRawBuf
nextRawBuf!
withXorbool

nextAddressBlock ​

📄 argon2id.vx L318-327

vex
fn nextAddressBlock(input: RawBuf, out: RawBuf)

Parameters:

NameType
inputRawBuf
outRawBuf

selectRefIndex ​

📄 argon2id.vx L329-375

vex
fn selectRefIndex(pass: i64, lane: i64, slice: i64, idxInSeg: i64, lanes: i64, laneLen: i64, j1: u64, j2: u64): i64

Parameters:

NameType
passi64
lanei64
slicei64
idxInSegi64
lanesi64
laneLeni64
j1u64
j2u64

Returns: i64


seedInitBlock ​

📄 argon2id.vx L377-383

vex
fn seedInitBlock(h0: RawBuf, j: u32, i: u32, out: RawBuf)

Parameters:

NameType
h0RawBuf
ju32
iu32
outRawBuf

argon2DeriveVariant ​

📄 argon2id.vx L386-398

vex
fn argon2DeriveVariant(variant: u8, password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Derive key bytes using the selected RFC 9106 Argon2 variant.

Parameters:

NameType
variantu8
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


argon2DeriveVariantEx ​

📄 argon2id.vx L400-668

vex
fn argon2DeriveVariantEx(variant: u8, password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, secret: RawBuf, secretLen: u64, ad: RawBuf, adLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf!, outLen: u64): Result<(), CryptoError>

Parameters:

NameType
variantu8
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
secretRawBuf
secretLenu64
adRawBuf
adLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf!
outLenu64

Returns: Result<(), CryptoError>


argon2idDerive 🔓 export ​

📄 argon2id.vx L671-681

vex
export fn argon2idDerive(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Argon2id derivation (recommended default).

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


argon2idDeriveEx 🔓 export ​

📄 argon2id.vx L684-696

vex
export fn argon2idDeriveEx(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, secret: RawBuf, secretLen: u64, ad: RawBuf, adLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Argon2id derivation with optional secret/ad fields (RFC-style inputs).

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
secretRawBuf
secretLenu64
adRawBuf
adLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


argon2iDerive 🔓 export ​

📄 argon2id.vx L699-709

vex
export fn argon2iDerive(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Argon2i derivation (data-independent indexing).

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


argon2iDeriveEx 🔓 export ​

📄 argon2id.vx L712-724

vex
export fn argon2iDeriveEx(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, secret: RawBuf, secretLen: u64, ad: RawBuf, adLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Argon2i derivation with optional secret/ad fields.

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
secretRawBuf
secretLenu64
adRawBuf
adLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


argon2dDerive 🔓 export ​

📄 argon2id.vx L727-737

vex
export fn argon2dDerive(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Argon2d derivation (data-dependent indexing).

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


argon2dDeriveEx 🔓 export ​

📄 argon2id.vx L740-752

vex
export fn argon2dDeriveEx(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, secret: RawBuf, secretLen: u64, ad: RawBuf, adLen: u64, timeCost: u64, memoryKiB: u64, parallelism: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Argon2d derivation with optional secret/ad fields.

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
secretRawBuf
secretLenu64
adRawBuf
adLenu64
timeCostu64
memoryKiBu64
parallelismu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


clearArgonVec ​

📄 argon2id.vx L785-790

vex
fn clearArgonVec(output: &Vec<u8>!)

Parameters:

NameType
output&Vec<u8>!

argonSpanOverlapsOutput ​

📄 argon2id.vx L792-800

vex
fn argonSpanOverlapsOutput(source: Span<u8>, output: &Vec<u8>): bool

Parameters:

NameType
sourceSpan<u8>
output&Vec<u8>

Returns: bool


validateArgonFacade ​

📄 argon2id.vx L802-823

vex
fn validateArgonFacade(passwordLength: usize, saltLength: usize, secretLength: usize, associatedDataLength: usize, parameters: Argon2Parameters, outputLength: usize): Result<(), CryptoError>

Parameters:

NameType
passwordLengthusize
saltLengthusize
secretLengthusize
associatedDataLengthusize
parametersArgon2Parameters
outputLengthusize

Returns: Result<(), CryptoError>


b64At ​

📄 base64.vx L1-7

vex
fn b64At(n: u8): u8

Parameters:

NameType
nu8

Returns: u8


base64Encode 🔓 export ​

📄 base64.vx L10-57

vex
export fn base64Encode(src: RawBuf, len: u64): string

Base64 encode raw bytes (RFC 4648, padded).

Parameters:

NameType
srcRawBuf
lenu64

Returns: string


base64EncodeString 🔓 export ​

📄 base64.vx L60-62

vex
export fn base64EncodeString(s: str): string

Base64 encode string bytes as UTF-8 byte sequence.

Parameters:

NameType
sstr

Returns: string


rotr64 ​

📄 blake2b.vx L4-6

vex
fn rotr64(x: u64, n: u64): u64

Parameters:

NameType
xu64
nu64

Returns: u64


loadLe64 ​

📄 blake2b.vx L8-10

vex
fn loadLe64(buf: RawBuf!, off: usize): u64

Parameters:

NameType
bufRawBuf!
offusize

Returns: u64


storeLe64 ​

📄 blake2b.vx L12-14

vex
fn storeLe64(buf: RawBuf!, off: usize, v: u64)

Parameters:

NameType
bufRawBuf!
offusize
vu64

ivAt ​

📄 blake2b.vx L16-27

vex
fn ivAt(i: usize): u64

Parameters:

NameType
iusize

Returns: u64


sigmaRow ​

📄 blake2b.vx L29-42

vex
fn sigmaRow(r: usize): [u8; 16]

Parameters:

NameType
rusize

Returns: [u8; 16]


g ​

📄 blake2b.vx L44-66

vex
fn g(vb: RawBuf, a: usize, b: usize, c: usize, d: usize, x: u64, y: u64)

Parameters:

NameType
vbRawBuf
ausize
busize
cusize
dusize
xu64
yu64

compress ​

📄 blake2b.vx L68-116

vex
fn compress(h: RawBuf, block: RawBuf, t: u64, fFinal: bool)

Parameters:

NameType
hRawBuf
blockRawBuf
tu64
fFinalbool

blake2bTo 🔓 export ​

📄 blake2b.vx L120-175

vex
export fn blake2bTo(data: RawBuf, len: u64, out: Ptr<u8>, outLen: u64)

Compute BLAKE2b hash to caller-provided output buffer.

outLen must be in [1, 64].

Parameters:

NameType
dataRawBuf
lenu64
outPtr<u8>
outLenu64

blake2bHex 🔓 export ​

📄 blake2b.vx L177-181

vex
export fn blake2bHex(data: str): string

Parameters:

NameType
datastr

Returns: string


ctEq 🔓 export ​

📄 bytes.vx L5-29

vex
export fn ctEq(a: RawBuf, aLen: u64, b: RawBuf, bLen: u64): bool

Constant-time equality over two byte slices (64-bit SWAR accelerated).

Returns false on length mismatch.

Parameters:

NameType
aRawBuf
aLenu64
bRawBuf
bLenu64

Returns: bool


xorInto 🔓 export ​

📄 bytes.vx L32-48

vex
export fn xorInto(dst: RawBuf, a: RawBuf, b: RawBuf, len: u64)

XOR two sources into destination: dst[i] = a[i] ^ b[i] (64-bit SWAR accelerated)

Parameters:

NameType
dstRawBuf
aRawBuf
bRawBuf
lenu64

xorInPlace 🔓 export ​

📄 bytes.vx L51-67

vex
export fn xorInPlace(dst: RawBuf, src: RawBuf, len: u64)

In-place XOR: dst[i] ^= src[i] (64-bit SWAR accelerated)

Parameters:

NameType
dstRawBuf
srcRawBuf
lenu64

zeroize 🔓 export ​

📄 bytes.vx L71-73

vex
export fn zeroize(buf: RawBuf, len: u64)

Zeroize sensitive buffer memory. The compiler lowers this to a volatile

memset so the stores survive dead-store elimination before deallocation.

Parameters:

NameType
bufRawBuf
lenu64

rotl32 ​

📄 chacha20.vx L7-9

vex
fn rotl32(v: u32, n: u32): u32

Parameters:

NameType
vu32
nu32

Returns: u32


loadLe32 ​

📄 chacha20.vx L11-13

vex
fn loadLe32(buf: RawBuf, off: usize): u32

Parameters:

NameType
bufRawBuf
offusize

Returns: u32


storeLe32 ​

📄 chacha20.vx L15-17

vex
fn storeLe32(buf: RawBuf, off: usize, v: u32)

Parameters:

NameType
bufRawBuf
offusize
vu32

quarterRound ​

📄 chacha20.vx L19-26

vex
fn quarterRound(a: u32, b: u32, c: u32, d: u32): [u32; 4]

Parameters:

NameType
au32
bu32
cu32
du32

Returns: [u32; 4]


chacha20Block 🔓 export ​

📄 chacha20.vx L29-73

vex
export fn chacha20Block(key: RawBuf, nonce: RawBuf, counter: u32, out: RawBuf)

Generate one 64-byte ChaCha20 block.

Parameters:

NameType
keyRawBuf
nonceRawBuf
counteru32
outRawBuf

chacha20Xor 🔓 export ​

📄 chacha20.vx L76-154

vex
export fn chacha20Xor(out: RawBuf, input: RawBuf, len: u64, key: RawBuf, nonce: RawBuf, counter: u32): Result<(), CryptoError>

XOR stream with input using 4-way SIMD parallel block pass (256 bytes per iteration).

Parameters:

NameType
outRawBuf
inputRawBuf
lenu64
keyRawBuf
nonceRawBuf
counteru32

Returns: Result<(), CryptoError>


loadLe32 ​

📄 chacha20_4way.vx L5-7

vex
fn loadLe32(buf: RawBuf, off: usize): u32

Parameters:

NameType
bufRawBuf
offusize

Returns: u32


rotl32 ​

📄 chacha20_4way.vx L9-11

vex
fn rotl32(v: u32, n: u32): u32

Parameters:

NameType
vu32
nu32

Returns: u32


qr ​

📄 chacha20_4way.vx L13-20

vex
fn qr(a: u32, b: u32, c: u32, d: u32): [u32; 4]

Parameters:

NameType
au32
bu32
cu32
du32

Returns: [u32; 4]


pack64 ​

📄 chacha20_4way.vx L22-24

vex
fn pack64(lo: u32, hi: u32): u64

Parameters:

NameType
lou32
hiu32

Returns: u64


chacha20Block4Way 🔓 export ​

📄 chacha20_4way.vx L27-151

vex
export fn chacha20Block4Way(key: RawBuf, nonce: RawBuf, counter: u32, out256: RawBuf)

Generate 4 consecutive ChaCha20 blocks (256 bytes) in 4-way parallel.

Parameters:

NameType
keyRawBuf
nonceRawBuf
counteru32
out256RawBuf

pointIdentity 🔓 export ​

📄 ed25519.vx L20-25

vex
export fn pointIdentity(out: &ExtPoint!)

Parameters:

NameType
out&ExtPoint!

edD ​

📄 ed25519.vx L28-42

vex
fn edD(out: &Fe25519!)

Parameters:

NameType
out&Fe25519!

ed2D ​

📄 ed25519.vx L45-49

vex
fn ed2D(out: &Fe25519!)

Parameters:

NameType
out&Fe25519!

affIdentity ​

📄 ed25519.vx L58-61

vex
fn affIdentity(out: &AffPoint!)

Parameters:

NameType
out&AffPoint!

affBasepoint ​

📄 ed25519.vx L63-80

vex
fn affBasepoint(out: &AffPoint!)

Parameters:

NameType
out&AffPoint!

affAdd ​

📄 ed25519.vx L82-107

vex
fn affAdd(p: &AffPoint, q: &AffPoint, out: &AffPoint!)

Parameters:

NameType
p&AffPoint
q&AffPoint
out&AffPoint!

affScalarMul ​

📄 ed25519.vx L109-131

vex
fn affScalarMul(scalar: RawBuf, point: &AffPoint, out: &AffPoint!)

Parameters:

NameType
scalarRawBuf
point&AffPoint
out&AffPoint!

feCopyAff ​

📄 ed25519.vx L133-136

vex
fn feCopyAff(p: &AffPoint, out: &AffPoint!)

Parameters:

NameType
p&AffPoint
out&AffPoint!

affEncode ​

📄 ed25519.vx L138-147

vex
fn affEncode(p: &AffPoint, out: RawBuf)

Parameters:

NameType
p&AffPoint
outRawBuf

feEq ​

📄 ed25519.vx L149-162

vex
fn feEq(a: &Fe25519, b: &Fe25519): bool

Parameters:

NameType
a&Fe25519
b&Fe25519

Returns: bool


fePowConst ​

📄 ed25519.vx L164-184

vex
fn fePowConst(base: &Fe25519, expLe: RawBuf, out: &Fe25519!)

Parameters:

NameType
base&Fe25519
expLeRawBuf
out&Fe25519!

feSqrtM1 ​

📄 ed25519.vx L186-199

vex
fn feSqrtM1(out: &Fe25519!)

Parameters:

NameType
out&Fe25519!

feSqrtRatio ​

📄 ed25519.vx L201-237

vex
fn feSqrtRatio(u: &Fe25519, v: &Fe25519, out: &Fe25519!): bool

Parameters:

NameType
u&Fe25519
v&Fe25519
out&Fe25519!

Returns: bool


scalarLessThanL ​

📄 ed25519.vx L239-254

vex
fn scalarLessThanL(s: RawBuf): bool

Parameters:

NameType
sRawBuf

Returns: bool


affDecodeCompressed ​

📄 ed25519.vx L256-317

vex
fn affDecodeCompressed(in32: RawBuf, out: &AffPoint!): bool

Parameters:

NameType
in32RawBuf
out&AffPoint!

Returns: bool


affToExt ​

📄 ed25519.vx L320-325

vex
fn affToExt(p: &AffPoint, out: &ExtPoint!)

Parameters:

NameType
p&AffPoint
out&ExtPoint!

pointDouble 🔓 export ​

📄 ed25519.vx L335-359

vex
export fn pointDouble(p: &ExtPoint, out: &ExtPoint!)

Parameters:

NameType
p&ExtPoint
out&ExtPoint!

pointAdd 🔓 export ​

📄 ed25519.vx L362-398

vex
export fn pointAdd(p: &ExtPoint, q: &ExtPoint, out: &ExtPoint!)

Parameters:

NameType
p&ExtPoint
q&ExtPoint
out&ExtPoint!

pointCopy ​

📄 ed25519.vx L400-405

vex
fn pointCopy(point: &ExtPoint, out: &ExtPoint!)

Parameters:

NameType
point&ExtPoint
out&ExtPoint!

pointCmov ​

📄 ed25519.vx L409-431

vex
fn pointCmov(candidate: &ExtPoint, choose: u64, out: &ExtPoint!)

Parameters:

NameType
candidate&ExtPoint
chooseu64
out&ExtPoint!

ctEqNibble ​

📄 ed25519.vx L433-436

vex
fn ctEqNibble(left: u64, right: u64): u64

Parameters:

NameType
leftu64
rightu64

Returns: u64


scalarMul 🔓 export ​

📄 ed25519.vx L443-494

vex
export fn scalarMul(scalar: RawBuf, point: &ExtPoint, out: &ExtPoint!)

Parameters:

NameType
scalarRawBuf
point&ExtPoint
out&ExtPoint!

extIsIdentity ​

📄 ed25519.vx L496-500

vex
fn extIsIdentity(point: &ExtPoint): bool

Parameters:

NameType
point&ExtPoint

Returns: bool


extHasSmallOrder ​

📄 ed25519.vx L502-511

vex
fn extHasSmallOrder(point: &ExtPoint): bool

Parameters:

NameType
point&ExtPoint

Returns: bool


pointEncode 🔓 export ​

📄 ed25519.vx L514-533

vex
export fn pointEncode(p: &ExtPoint, out: RawBuf)

Parameters:

NameType
p&ExtPoint
outRawBuf

basepointExt 🔓 export ​

📄 ed25519.vx L536-560

vex
export fn basepointExt(out: &ExtPoint!)

Parameters:

NameType
out&ExtPoint!

scalarL ​

📄 ed25519.vx L564-575

vex
fn scalarL(): [u8; 32]

Returns: [u8; 32]


reduceModL64 ​

📄 ed25519.vx L577-640

vex
fn reduceModL64(x64: RawBuf): [u8; 32]

Parameters:

NameType
x64RawBuf

Returns: [u8; 32]


mulScalar32 ​

📄 ed25519.vx L642-677

vex
fn mulScalar32(a: RawBuf, b: RawBuf): [u8; 64]

Parameters:

NameType
aRawBuf
bRawBuf

Returns: [u8; 64]


scMulAdd ​

📄 ed25519.vx L679-700

vex
fn scMulAdd(r: RawBuf, k: RawBuf, a: RawBuf): [u8; 32]

Parameters:

NameType
rRawBuf
kRawBuf
aRawBuf

Returns: [u8; 32]


scReduce ​

📄 ed25519.vx L702-704

vex
fn scReduce(hash: RawBuf): [u8; 32]

Parameters:

NameType
hashRawBuf

Returns: [u8; 32]


ed25519PublicKey 🔓 export ​

📄 ed25519.vx L709-736

vex
export fn ed25519PublicKey(pubOut: RawBuf, privateKey: RawBuf)

Ed25519 key pair generation.

privateKey: 32 random bytes. Writes 32-byte public key to pubOut.

Parameters:

NameType
pubOutRawBuf
privateKeyRawBuf

ed25519Sign 🔓 export ​

📄 ed25519.vx L741-826

vex
export fn ed25519Sign(sigOut: RawBuf, privateKey: RawBuf, message: RawBuf, msgLen: u64)

Ed25519 sign a message.

Writes 64-byte signature to sigOut. privateKey: 32 bytes, message: raw bytes.

Parameters:

NameType
sigOutRawBuf
privateKeyRawBuf
messageRawBuf
msgLenu64

ed25519SignHex 🔓 export ​

📄 ed25519.vx L829-833

vex
export fn ed25519SignHex(privateKey: RawBuf, message: RawBuf, msgLen: u64): string

Ed25519 sign returning hex(signature[64]).

Parameters:

NameType
privateKeyRawBuf
messageRawBuf
msgLenu64

Returns: string


ed25519Verify 🔓 export ​

📄 ed25519.vx L836-912

vex
export fn ed25519Verify(signature: RawBuf, publicKey: RawBuf, message: RawBuf, msgLen: u64): bool

Ed25519 verify: returns true iff signature is valid.

Parameters:

NameType
signatureRawBuf
publicKeyRawBuf
messageRawBuf
msgLenu64

Returns: bool


ed25519PublicKeyHex 🔓 export ​

📄 ed25519.vx L915-919

vex
export fn ed25519PublicKeyHex(privateKey: RawBuf): string

Ed25519 public key generation returning hex.

Parameters:

NameType
privateKeyRawBuf

Returns: string


ed25519BasepointHex 🔓 export ​

📄 ed25519.vx L922-928

vex
export fn ed25519BasepointHex(): string

Diagnostic helper: return encoded Ed25519 basepoint.

Returns: string


ed25519MulBaseHex 🔓 export ​

📄 ed25519.vx L931-939

vex
export fn ed25519MulBaseHex(scalar: RawBuf): string

Diagnostic helper: encode scalar*B for a raw 32-byte scalar.

Parameters:

NameType
scalarRawBuf

Returns: string


feLoadLe64 ​

📄 field25519.vx L5-7

vex
fn feLoadLe64(buf: RawBuf, off: usize): u64

Parameters:

NameType
bufRawBuf
offusize

Returns: u64


feZero 🔓 export ​

📄 field25519.vx L15-21

vex
export fn feZero(out: &Fe25519!)

Parameters:

NameType
out&Fe25519!

feOne 🔓 export ​

📄 field25519.vx L23-29

vex
export fn feOne(out: &Fe25519!)

Parameters:

NameType
out&Fe25519!

feCopy 🔓 export ​

📄 field25519.vx L32-38

vex
export fn feCopy(f: &Fe25519, out: &Fe25519!)

Copy a field element (creates a new value from a reference)

Parameters:

NameType
f&Fe25519
out&Fe25519!

feFromBytes 🔓 export ​

📄 field25519.vx L41-55

vex
export fn feFromBytes(b: RawBuf, out: &Fe25519!)

Parameters:

NameType
bRawBuf
out&Fe25519!

feToBytes 🔓 export ​

📄 field25519.vx L58-90

vex
export fn feToBytes(f: &Fe25519, out: RawBuf)

Parameters:

NameType
f&Fe25519
outRawBuf

feCarryPropagate ​

📄 field25519.vx L92-119

vex
fn feCarryPropagate(f: &Fe25519, out: &Fe25519!)

Parameters:

NameType
f&Fe25519
out&Fe25519!

feReduce ​

📄 field25519.vx L121-160

vex
fn feReduce(f: &Fe25519, out: &Fe25519!)

Parameters:

NameType
f&Fe25519
out&Fe25519!

feAdd 🔓 export ​

📄 field25519.vx L162-170

vex
export fn feAdd(a: &Fe25519, b: &Fe25519, out: &Fe25519!)

Parameters:

NameType
a&Fe25519
b&Fe25519
out&Fe25519!

feSub 🔓 export ​

📄 field25519.vx L172-182

vex
export fn feSub(a: &Fe25519, b: &Fe25519, out: &Fe25519!)

Parameters:

NameType
a&Fe25519
b&Fe25519
out&Fe25519!

feReduceWide ​

📄 field25519.vx L188-217

vex
fn feReduceWide(t0: u128, t1: u128, t2: u128, t3: u128, t4: u128, out: &Fe25519!)

Parameters:

NameType
t0u128
t1u128
t2u128
t3u128
t4u128
out&Fe25519!

feMul 🔓 export ​

📄 field25519.vx L219-237

vex
export fn feMul(a: &Fe25519, b: &Fe25519, out: &Fe25519!)

Parameters:

NameType
a&Fe25519
b&Fe25519
out&Fe25519!

feMulSmall 🔓 export ​

📄 field25519.vx L243-253

vex
export fn feMulSmall(a: &Fe25519, coefficient: u64, out: &Fe25519!)

Multiply by a single machine-word coefficient. This is the canonical

constant/small-coefficient path for field formulas: it preserves the same reduction semantics as feMul without manufacturing a sparse field element and paying for its zero products.

Parameters:

NameType
a&Fe25519
coefficientu64
out&Fe25519!

feSq 🔓 export ​

📄 field25519.vx L255-257

vex
export fn feSq(a: &Fe25519, out: &Fe25519!)

Parameters:

NameType
a&Fe25519
out&Fe25519!

feSqN ​

📄 field25519.vx L276-283

vex
fn feSqN(a: &Fe25519, n: i64, out: &Fe25519!)

Parameters:

NameType
a&Fe25519
ni64
out&Fe25519!

feInvert 🔓 export ​

📄 field25519.vx L286-338

vex
export fn feInvert(z: &Fe25519, out: &Fe25519!)

Parameters:

NameType
z&Fe25519
out&Fe25519!

feCSwap 🔓 export ​

📄 field25519.vx L341-350

vex
export fn feCSwap(a: &Fe25519!, b: &Fe25519!, swap: u64)

Parameters:

NameType
a&Fe25519!
b&Fe25519!
swapu64

hexChar ​

📄 hex.vx L1-4

vex
fn hexChar(n: u8): u8

Parameters:

NameType
nu8

Returns: u8


fromHexNibble ​

📄 hex.vx L6-11

vex
fn fromHexNibble(c: u8): i32

Parameters:

NameType
cu8

Returns: i32


hexEncode 🔓 export ​

📄 hex.vx L14-34

vex
export fn hexEncode(src: RawBuf, len: u64): string

Encode raw bytes to lowercase hex string.

Parameters:

NameType
srcRawBuf
lenu64

Returns: string


hexDecodeTo 🔓 export ​

📄 hex.vx L38-58

vex
export fn hexDecodeTo(hex: str, out: RawBuf, outCap: u64): u64

Decode hex string to bytes into caller-provided output buffer.

Returns number of written bytes, or 0 on invalid hex/out-of-capacity.

Parameters:

NameType
hexstr
outRawBuf
outCapu64

Returns: u64


hkdfExtract 🔓 export ​

📄 hkdf.vx L9-29

vex
export fn hkdfExtract(salt: RawBuf, saltLen: u64, ikm: RawBuf, ikmLen: u64, prk: Ptr<u8>): Result<(), CryptoError>

HKDF-Extract: PRK = HMAC-SHA256(salt, IKM)

If salt is empty (saltLen==0), uses 32 zero bytes as default salt.

Parameters:

NameType
saltRawBuf
saltLenu64
ikmRawBuf
ikmLenu64
prkPtr<u8>

Returns: Result<(), CryptoError>


hkdfExpand 🔓 export ​

📄 hkdf.vx L33-81

vex
export fn hkdfExpand(prk: RawBuf, prkLen: u64, info: RawBuf, infoLen: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

HKDF-Expand: derive output keying material from PRK.

prk: 32 bytes (from hkdfExtract), outLen ≤ 255*32 = 8160 bytes.

Parameters:

NameType
prkRawBuf
prkLenu64
infoRawBuf
infoLenu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


hkdf 🔓 export ​

📄 hkdf.vx L84-95

vex
export fn hkdf(salt: RawBuf, saltLen: u64, ikm: RawBuf, ikmLen: u64, info: RawBuf, infoLen: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

One-shot HKDF: Extract + Expand.

Parameters:

NameType
saltRawBuf
saltLenu64
ikmRawBuf
ikmLenu64
infoRawBuf
infoLenu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


hkdfExtractSha384 🔓 export ​

📄 hkdf.vx L99-119

vex
export fn hkdfExtractSha384(salt: RawBuf, saltLen: u64, ikm: RawBuf, ikmLen: u64, prk: Ptr<u8>): Result<(), CryptoError>

HKDF-Extract with HMAC-SHA384. An empty salt is represented by one

SHA-384 digest-length block of zero bytes, as required by RFC 5869.

Parameters:

NameType
saltRawBuf
saltLenu64
ikmRawBuf
ikmLenu64
prkPtr<u8>

Returns: Result<(), CryptoError>


hkdfExpandSha384 🔓 export ​

📄 hkdf.vx L122-165

vex
export fn hkdfExpandSha384(prk: RawBuf, prkLen: u64, info: RawBuf, infoLen: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

HKDF-Expand with HMAC-SHA384. The RFC 5869 limit is 255 digest blocks.

Parameters:

NameType
prkRawBuf
prkLenu64
infoRawBuf
infoLenu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


hkdfSha384 🔓 export ​

📄 hkdf.vx L167-180

vex
export fn hkdfSha384(salt: RawBuf, saltLen: u64, ikm: RawBuf, ikmLen: u64, info: RawBuf, infoLen: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

Parameters:

NameType
saltRawBuf
saltLenu64
ikmRawBuf
ikmLenu64
infoRawBuf
infoLenu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


hmacSha1To 🔓 export ​

📄 hmac.vx L12-62

vex
export fn hmacSha1To(key: RawBuf, keyLen: u64, data: RawBuf, dataLen: u64, out: Ptr<u8>)

HMAC-SHA1 (RFC 2104). SHA-1 is retained solely for interoperating with

protocol profiles such as SRTP AES_CM_128_HMAC_SHA1_80; new application protocols should use HMAC-SHA256 instead.

Parameters:

NameType
keyRawBuf
keyLenu64
dataRawBuf
dataLenu64
outPtr<u8>

hmacSha256To 🔓 export ​

📄 hmac.vx L64-159

vex
export fn hmacSha256To(key: RawBuf, keyLen: u64, data: RawBuf, dataLen: u64, out: Ptr<u8>)

Parameters:

NameType
keyRawBuf
keyLenu64
dataRawBuf
dataLenu64
outPtr<u8>

hmacSha256PartsTo 🔓 export ​

📄 hmac.vx L164-215

vex
export fn hmacSha256PartsTo(key: RawBuf, keyLen: u64, first: RawBuf, firstLen: u64, second: RawBuf, secondLen: u64, third: RawBuf, thirdLen: u64, out: Ptr<u8>)

Allocation-free HMAC-SHA256 over three discontiguous byte segments.

This is the shared kernel for HKDF/PBKDF2; no secret-bearing concatenation buffer or per-round allocator traffic is required.

Parameters:

NameType
keyRawBuf
keyLenu64
firstRawBuf
firstLenu64
secondRawBuf
secondLenu64
thirdRawBuf
thirdLenu64
outPtr<u8>

hmacSha384PartsTo 🔓 export ​

📄 hmac.vx L219-270

vex
export fn hmacSha384PartsTo(key: RawBuf, keyLen: u64, first: RawBuf, firstLen: u64, second: RawBuf, secondLen: u64, third: RawBuf, thirdLen: u64, out: Ptr<u8>)

Allocation-free HMAC-SHA384 over three discontiguous byte segments.

SHA-384 uses SHA-512's 128-byte block size and a 48-byte digest.

Parameters:

NameType
keyRawBuf
keyLenu64
firstRawBuf
firstLenu64
secondRawBuf
secondLenu64
thirdRawBuf
thirdLenu64
outPtr<u8>

hmacSha384To 🔓 export ​

📄 hmac.vx L272-282

vex
export fn hmacSha384To(key: RawBuf, keyLen: u64, data: RawBuf, dataLen: u64, out: Ptr<u8>)

Parameters:

NameType
keyRawBuf
keyLenu64
dataRawBuf
dataLenu64
outPtr<u8>

hmacSha384Hex 🔓 export ​

📄 hmac.vx L284-292

vex
export fn hmacSha384Hex(key: str, data: str): string

Parameters:

NameType
keystr
datastr

Returns: string


hmacSha256Hex 🔓 export ​

📄 hmac.vx L294-311

vex
export fn hmacSha256Hex(key: str, data: str): string

Parameters:

NameType
keystr
datastr

Returns: string


hmacVerifySha256Hex 🔓 export ​

📄 hmac.vx L313-340

vex
export fn hmacVerifySha256Hex(key: str, data: str, expectedHex: str): bool

Parameters:

NameType
keystr
datastr
expectedHexstr

Returns: bool


pbkdf2Sha256 🔓 export ​

📄 pbkdf2.vx L8-103

vex
export fn pbkdf2Sha256(password: RawBuf, pwdLen: u64, salt: RawBuf, saltLen: u64, iterations: u64, out: RawBuf, outLen: u64): Result<(), CryptoError>

PBKDF2 with HMAC-SHA256 as PRF.

Password and salt are raw buffers, iterations >= 1, output written to out.

Parameters:

NameType
passwordRawBuf
pwdLenu64
saltRawBuf
saltLenu64
iterationsu64
outRawBuf
outLenu64

Returns: Result<(), CryptoError>


pbkdf2Sha256Hex 🔓 export ​

📄 pbkdf2.vx L106-128

vex
export fn pbkdf2Sha256Hex(password: str, salt: str, iterations: u64, dkLen: u64): Result<string, CryptoError>

Convenience: PBKDF2-SHA256 with string inputs, returns hex-encoded output.

Parameters:

NameType
passwordstr
saltstr
iterationsu64
dkLenu64

Returns: Result<string, CryptoError>


p1305LoadLe32 ​

📄 poly1305.vx L5-7

vex
fn p1305LoadLe32(buf: RawBuf, off: usize): u32

Parameters:

NameType
bufRawBuf
offusize

Returns: u32


newPoly1305 🔓 export ​

📄 poly1305.vx L70-72

vex
export fn newPoly1305(key: RawBuf, key_len: usize): Poly1305

Parameters:

NameType
keyRawBuf
key_lenusize

Returns: Poly1305


poly1305Auth 🔓 export ​

📄 poly1305.vx L318-322

vex
export fn poly1305Auth(key: RawBuf, key_len: usize, message: RawBuf, msg_len: usize): [u8; 16]

Parameters:

NameType
keyRawBuf
key_lenusize
messageRawBuf
msg_lenusize

Returns: [u8; 16]


rol32 ​

📄 sha1.vx L3-5

vex
fn rol32(x: u32, n: u32): u32

Parameters:

NameType
xu32
nu32

Returns: u32


newSha1 🔓 export ​

📄 sha1.vx L35-37

vex
export fn newSha1(): Sha1

Returns: Sha1


sha1To 🔓 export ​

📄 sha1.vx L190-194

vex
export fn sha1To(data: RawBuf, len: u64, out: Ptr<u8>)

Parameters:

NameType
dataRawBuf
lenu64
outPtr<u8>

sha1Hex 🔓 export ​

📄 sha1.vx L196-204

vex
export fn sha1Hex(data: str): string

Parameters:

NameType
datastr

Returns: string


bswap32 ​

📄 sha256.vx L4-6

vex
fn bswap32(v: u32): u32

Parameters:

NameType
vu32

Returns: u32


k256 ​

📄 sha256.vx L27-32

vex
fn k256(t: i64): u32

Parameters:

NameType
ti64

Returns: u32


newSha256 🔓 export ​

📄 sha256.vx L65-67

vex
export fn newSha256(): Sha256

Returns: Sha256


sha256To 🔓 export ​

📄 sha256.vx L245-249

vex
export fn sha256To(data: RawBuf, len: u64, out: Ptr<u8>)

Parameters:

NameType
dataRawBuf
lenu64
outPtr<u8>

sha256Hex 🔓 export ​

📄 sha256.vx L251-263

vex
export fn sha256Hex(data: str): string

Parameters:

NameType
datastr

Returns: string


rotr64 ​

📄 sha512.vx L4-6

vex
fn rotr64(x: u64, n: u64): u64

Parameters:

NameType
xu64
nu64

Returns: u64


ch512 ​

📄 sha512.vx L8-10

vex
fn ch512(x: u64, y: u64, z: u64): u64

Parameters:

NameType
xu64
yu64
zu64

Returns: u64


maj512 ​

📄 sha512.vx L12-14

vex
fn maj512(x: u64, y: u64, z: u64): u64

Parameters:

NameType
xu64
yu64
zu64

Returns: u64


bsig0_512 ​

📄 sha512.vx L16-18

vex
fn bsig0_512(x: u64): u64

Parameters:

NameType
xu64

Returns: u64


bsig1_512 ​

📄 sha512.vx L20-22

vex
fn bsig1_512(x: u64): u64

Parameters:

NameType
xu64

Returns: u64


ssig0_512 ​

📄 sha512.vx L24-26

vex
fn ssig0_512(x: u64): u64

Parameters:

NameType
xu64

Returns: u64


ssig1_512 ​

📄 sha512.vx L28-30

vex
fn ssig1_512(x: u64): u64

Parameters:

NameType
xu64

Returns: u64


bswap64 ​

📄 sha512.vx L32-34

vex
fn bswap64(v: u64): u64

Parameters:

NameType
vu64

Returns: u64


k512 ​

📄 sha512.vx L36-63

vex
fn k512(t: i64): u64

Parameters:

NameType
ti64

Returns: u64


sha512Hex 🔓 export ​

📄 sha512.vx L324-331

vex
export fn sha512Hex(data: str): string

Parameters:

NameType
datastr

Returns: string


sha512To 🔓 export ​

📄 sha512.vx L333-338

vex
export fn sha512To(data: RawBuf, len: u64, out: Ptr<u8>)

Parameters:

NameType
dataRawBuf
lenu64
outPtr<u8>

sha384Hex 🔓 export ​

📄 sha512.vx L340-347

vex
export fn sha384Hex(data: str): string

Parameters:

NameType
datastr

Returns: string


sha384To 🔓 export ​

📄 sha512.vx L349-354

vex
export fn sha384To(data: RawBuf, len: u64, out: Ptr<u8>)

Parameters:

NameType
dataRawBuf
lenu64
outPtr<u8>

xorBlocks 🔓 export ​

📄 simd.vx L6-12

vex
export fn xorBlocks(dst: RawBuf, a: RawBuf, b: RawBuf, bytes: u64)

Parameters:

NameType
dstRawBuf
aRawBuf
bRawBuf
bytesu64

addU32Blocks 🔓 export ​

📄 simd.vx L14-21

vex
export fn addU32Blocks(dst: RawBuf, a: RawBuf, b: RawBuf, words: u64)

Parameters:

NameType
dstRawBuf
aRawBuf
bRawBuf
wordsu64

rotrU32Blocks 🔓 export ​

📄 simd.vx L23-31

vex
export fn rotrU32Blocks(dst: RawBuf, src: RawBuf, words: u64, shift: u32)

Parameters:

NameType
dstRawBuf
srcRawBuf
wordsu64
shiftu32

storeLe64 🔓 export ​

📄 utils.vx L4-13

vex
export fn storeLe64(buf: RawBuf, off: usize, v: u64)

Parameters:

NameType
bufRawBuf
offusize
vu64

storeBe64 🔓 export ​

📄 utils.vx L15-24

vex
export fn storeBe64(buf: RawBuf, off: usize, v: u64)

Parameters:

NameType
bufRawBuf
offusize
vu64

x25519 🔓 export ​

📄 x25519.vx L13-92

vex
export fn x25519(out: RawBuf, scalar: RawBuf, point: RawBuf)

Scalar multiplication: result = scalar * point on Curve25519.

Both scalar and point are 32 bytes (little-endian). Result written to out (32 bytes).

Parameters:

NameType
outRawBuf
scalarRawBuf
pointRawBuf

x25519Basepoint 🔓 export ​

📄 x25519.vx L97-102

vex
export fn x25519Basepoint(out: RawBuf, privateKey: RawBuf)

Generate X25519 public key from private key.

Private key: 32 random bytes (will be clamped internally). Uses basepoint u=9.

Parameters:

NameType
outRawBuf
privateKeyRawBuf

x25519Hex 🔓 export ​

📄 x25519.vx L105-109

vex
export fn x25519Hex(myPrivate: RawBuf, theirPublic: RawBuf): string

Compute X25519 shared secret, returns hex string.

Parameters:

NameType
myPrivateRawBuf
theirPublicRawBuf

Returns: string


test_aead_rfc8439 🔓 export ​

📄 aead.test.vx L4-124

vex
export fn test_aead_rfc8439(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aead_tamper_reject 🔓 export ​

📄 aead.test.vx L126-172

vex
export fn test_aead_tamper_reject(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aes128_fips197_block_vector 🔓 export ​

📄 aes_gcm.test.vx L6-23

vex
export fn test_aes128_fips197_block_vector(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aes128_gcm_nist_zero_vector 🔓 export ​

📄 aes_gcm.test.vx L25-68

vex
export fn test_aes128_gcm_nist_zero_vector(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aes_gcm_roundtrip 🔓 export ​

📄 aes_gcm.test.vx L70-117

vex
export fn test_aes_gcm_roundtrip(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aes_gcm_reject_tamper 🔓 export ​

📄 aes_gcm.test.vx L119-162

vex
export fn test_aes_gcm_reject_tamper(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aes_ctr_rejects_counter_wrap_before_output 🔓 export ​

📄 aes_gcm.test.vx L164-192

vex
export fn test_aes_ctr_rejects_counter_wrap_before_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_aes_ctr_initial_counter_allows_final_block 🔓 export ​

📄 aes_gcm.test.vx L197-216

vex
export fn test_aes_ctr_initial_counter_allows_final_block(ctx: &TestCtx!)

Initial-counter CTR may encrypt the all-ones counter exactly once. The

separate preflight must not accidentally apply GCM/J0's pre-increment rule and reject that valid final block.

Parameters:

NameType
ctx&TestCtx!

test_aes_gcm_rejects_oversized_payload_before_output 🔓 export ​

📄 aes_gcm.test.vx L218-246

vex
export fn test_aes_gcm_rejects_oversized_payload_before_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

arraySpan ​

📄 api.test.vx L8-10

vex
fn arraySpan<const N: usize>(value: &[u8; N]): Span<u8>

Type Parameters:

  • const N: usize

Parameters:

NameType
value&[u8; N]

Returns: Span<u8>


strBytes ​

📄 api.test.vx L12-14

vex
fn strBytes(value: str): Span<u8>

Parameters:

NameType
valuestr

Returns: Span<u8>


assertBytes ​

📄 api.test.vx L16-22

vex
fn assertBytes(ctx: &TestCtx!, actual: &Vec<u8>, expected: Span<u8>)

Parameters:

NameType
ctx&TestCtx!
actual&Vec<u8>
expectedSpan<u8>

test_safe_chacha_combined_roundtrip_and_reuse 🔓 export ​

📄 api.test.vx L24-61

vex
export fn test_safe_chacha_combined_roundtrip_and_reuse(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_aes256_gcm_combined_roundtrip 🔓 export ​

📄 api.test.vx L63-84

vex
export fn test_safe_aes256_gcm_combined_roundtrip(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_aes128_gcm_combined_roundtrip_and_dimensions 🔓 export ​

📄 api.test.vx L86-119

vex
export fn test_safe_aes128_gcm_combined_roundtrip_and_dimensions(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_facade_rejects_dimensions_and_clears_output 🔓 export ​

📄 api.test.vx L121-143

vex
export fn test_safe_facade_rejects_dimensions_and_clears_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_facade_auth_failure_releases_no_plaintext 🔓 export ​

📄 api.test.vx L145-175

vex
export fn test_safe_facade_auth_failure_releases_no_plaintext(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_facade_stages_in_place_aliases 🔓 export ​

📄 api.test.vx L177-201

vex
export fn test_safe_facade_stages_in_place_aliases(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_hkdf_rfc5869_and_reuse 🔓 export ​

📄 api.test.vx L203-230

vex
export fn test_safe_hkdf_rfc5869_and_reuse(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_hkdf_sha384_reuse_and_failure_clearing 🔓 export ​

📄 api.test.vx L232-267

vex
export fn test_safe_hkdf_sha384_reuse_and_failure_clearing(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_pbkdf2_vector_and_parameter_error 🔓 export ​

📄 api.test.vx L269-294

vex
export fn test_safe_pbkdf2_vector_and_parameter_error(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_argon2id_reuse_alias_and_parameter_errors 🔓 export ​

📄 api.test.vx L296-349

vex
export fn test_safe_argon2id_reuse_alias_and_parameter_errors(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_argon2id_accepts_empty_password 🔓 export ​

📄 api.test.vx L351-363

vex
export fn test_safe_argon2id_accepts_empty_password(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_ed25519_roundtrip_and_dimensions 🔓 export ​

📄 api.test.vx L365-399

vex
export fn test_safe_ed25519_roundtrip_and_dimensions(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

expectArgonSuccess ​

📄 argon2id.test.vx L4-9

vex
fn expectArgonSuccess(result: Result<(), CryptoError>)

Parameters:

NameType
resultResult<(), CryptoError>

test_argon2id_deterministic 🔓 export ​

📄 argon2id.test.vx L11-40

vex
export fn test_argon2id_deterministic(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2id_param_sensitivity 🔓 export ​

📄 argon2id.test.vx L42-75

vex
export fn test_argon2id_param_sensitivity(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2_variants_produce_distinct_outputs 🔓 export ​

📄 argon2id.test.vx L77-116

vex
export fn test_argon2_variants_produce_distinct_outputs(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2_invalid_params_zero_output 🔓 export ​

📄 argon2id.test.vx L118-149

vex
export fn test_argon2_invalid_params_zero_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2id_ex_secret_ad_affect_output 🔓 export ​

📄 argon2id.test.vx L151-192

vex
export fn test_argon2id_ex_secret_ad_affect_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2i_d_ex_secret_ad_affect_output 🔓 export ​

📄 argon2id.test.vx L194-256

vex
export fn test_argon2i_d_ex_secret_ad_affect_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2id_long_output_deterministic 🔓 export ​

📄 argon2id.test.vx L258-289

vex
export fn test_argon2id_long_output_deterministic(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_argon2id_rfc9106_case 🔓 export ​

📄 argon2id.test.vx L291-311

vex
export fn test_argon2id_rfc9106_case(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

makeBytes ​

📄 bench.test.vx L12-24

vex
fn makeBytes(length: usize): RawBuf

Parameters:

NameType
lengthusize

Returns: RawBuf


observe ​

📄 bench.test.vx L26-31

vex
fn observe(buffer: RawBuf, length: usize, seed: i64): i64

Parameters:

NameType
bufferRawBuf
lengthusize
seedi64

Returns: i64


bench_sha256_4k ​

📄 bench.test.vx L33-45

vex
fn bench_sha256_4k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_chacha20_poly1305_seal_16k ​

📄 bench.test.vx L47-68

vex
fn bench_chacha20_poly1305_seal_16k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_chacha20_xor_16k ​

📄 bench.test.vx L70-88

vex
fn bench_chacha20_xor_16k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_poly1305_auth_16k ​

📄 bench.test.vx L90-103

vex
fn bench_poly1305_auth_16k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_aes128_gcm_seal_16k ​

📄 bench.test.vx L105-126

vex
fn bench_aes128_gcm_seal_16k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_aes256_gcm_seal_16k ​

📄 bench.test.vx L128-149

vex
fn bench_aes256_gcm_seal_16k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_x25519_public_key ​

📄 bench.test.vx L151-163

vex
fn bench_x25519_public_key(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_ed25519_sign_1k ​

📄 bench.test.vx L165-179

vex
fn bench_ed25519_sign_1k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_ed25519_verify_1k ​

📄 bench.test.vx L181-197

vex
fn bench_ed25519_verify_1k(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_argon2id_1mib_one_pass ​

📄 bench.test.vx L199-215

vex
fn bench_argon2id_1mib_one_pass(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

test_blake2b_empty 🔓 export ​

📄 blake2b.test.vx L4-9

vex
export fn test_blake2b_empty(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_blake2b_abc 🔓 export ​

📄 blake2b.test.vx L11-16

vex
export fn test_blake2b_abc(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_cteq_basic 🔓 export ​

📄 bytes.test.vx L3-13

vex
export fn test_cteq_basic(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_xor_and_zeroize 🔓 export ​

📄 bytes.test.vx L15-40

vex
export fn test_xor_and_zeroize(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

fillSeq ​

📄 chacha20.test.vx L4-11

vex
fn fillSeq(buf: RawBuf, n: i64)

Parameters:

NameType
bufRawBuf
ni64

test_chacha20_block_rfc8439 🔓 export ​

📄 chacha20.test.vx L13-49

vex
export fn test_chacha20_block_rfc8439(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_chacha20_xor_roundtrip 🔓 export ​

📄 chacha20.test.vx L51-110

vex
export fn test_chacha20_xor_roundtrip(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_chacha20_four_way_matches_scalar_blocks 🔓 export ​

📄 chacha20.test.vx L112-161

vex
export fn test_chacha20_four_way_matches_scalar_blocks(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_chacha20_rejects_counter_wrap_before_output 🔓 export ​

📄 chacha20.test.vx L163-189

vex
export fn test_chacha20_rejects_counter_wrap_before_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

main ​

📄 debug_sha256.vx L3-6

vex
fn main()

test_ed25519_public_key_rfc8032_case1 🔓 export ​

📄 ed25519_pk.test.vx L4-21

vex
export fn test_ed25519_public_key_rfc8032_case1(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_ed25519_sign_rfc8032_case1 🔓 export ​

📄 ed25519_sign.test.vx L4-28

vex
export fn test_ed25519_sign_rfc8032_case1(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_ed25519_verify_rfc8032_case1 🔓 export ​

📄 ed25519_verify.test.vx L4-28

vex
export fn test_ed25519_verify_rfc8032_case1(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_ed25519_verify_reject_tamper 🔓 export ​

📄 ed25519_verify.test.vx L30-55

vex
export fn test_ed25519_verify_reject_tamper(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

identityForgerySignature ​

📄 ed25519_verify.test.vx L57-69

vex
fn identityForgerySignature(): [u8; 64]

Returns: [u8; 64]


test_ed25519_verify_rejects_small_order_public_key 🔓 export ​

📄 ed25519_verify.test.vx L71-82

vex
export fn test_ed25519_verify_rejects_small_order_public_key(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_ed25519_verify_rejects_noncanonical_point_encoding 🔓 export ​

📄 ed25519_verify.test.vx L84-98

vex
export fn test_ed25519_verify_rejects_noncanonical_point_encoding(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

fillFieldInput ​

📄 field25519.test.vx L7-17

vex
fn fillFieldInput(seed: u64, out: &[u8; 32]!)

Parameters:

NameType
seedu64
out&[u8; 32]!

fieldEqual ​

📄 field25519.test.vx L19-30

vex
fn fieldEqual(a: &Fe25519, b: &Fe25519): bool

Parameters:

NameType
a&Fe25519
b&Fe25519

Returns: bool


test_field25519_wide_mul_and_square_properties 🔓 export ​

📄 field25519.test.vx L32-58

vex
export fn test_field25519_wide_mul_and_square_properties(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_field25519_inversion_identity 🔓 export ​

📄 field25519.test.vx L60-77

vex
export fn test_field25519_inversion_identity(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hex_encode_decode_roundtrip 🔓 export ​

📄 hex.test.vx L3-17

vex
export fn test_hex_encode_decode_roundtrip(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hex_decode_invalid 🔓 export ​

📄 hex.test.vx L19-29

vex
export fn test_hex_decode_invalid(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hkdf_sha384_extract_and_multiblock_expand 🔓 export ​

📄 hkdf.test.vx L7-43

vex
export fn test_hkdf_sha384_extract_and_multiblock_expand(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hkdf_sha384_rejects_oversized_output_before_write 🔓 export ​

📄 hkdf.test.vx L45-57

vex
export fn test_hkdf_sha384_rejects_oversized_output_before_write(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hkdf_extract_rfc5869 🔓 export ​

📄 hkdf.test.vx L59-88

vex
export fn test_hkdf_extract_rfc5869(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hkdf_expand_rfc5869 🔓 export ​

📄 hkdf.test.vx L90-124

vex
export fn test_hkdf_expand_rfc5869(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hkdf_rejects_oversized_output_before_write 🔓 export ​

📄 hkdf.test.vx L126-145

vex
export fn test_hkdf_rejects_oversized_output_before_write(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hmac_sha384_rfc4231_case1 🔓 export ​

📄 hmac.test.vx L6-27

vex
export fn test_hmac_sha384_rfc4231_case1(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hmac_sha1_rfc2202_case2 🔓 export ​

📄 hmac.test.vx L30-50

vex
export fn test_hmac_sha1_rfc2202_case2(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hmac_sha256_key_data 🔓 export ​

📄 hmac.test.vx L53-57

vex
export fn test_hmac_sha256_key_data(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_hmac_verify 🔓 export ​

📄 hmac.test.vx L59-67

vex
export fn test_hmac_verify(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_pbkdf2_rfc6070_1 🔓 export ​

📄 pbkdf2.test.vx L4-15

vex
export fn test_pbkdf2_rfc6070_1(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_pbkdf2_rfc6070_2 🔓 export ​

📄 pbkdf2.test.vx L17-27

vex
export fn test_pbkdf2_rfc6070_2(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_pbkdf2_rejects_zero_iterations_before_write 🔓 export ​

📄 pbkdf2.test.vx L29-50

vex
export fn test_pbkdf2_rejects_zero_iterations_before_write(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

assertTagEq ​

📄 poly1305.test.vx L4-10

vex
fn assertTagEq(ctx: &TestCtx!, left: [u8; 16], right: [u8; 16])

Parameters:

NameType
ctx&TestCtx!
left[u8; 16]
right[u8; 16]

test_poly1305_empty 🔓 export ​

📄 poly1305.test.vx L12-46

vex
export fn test_poly1305_empty(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_poly1305_rfc7539 🔓 export ​

📄 poly1305.test.vx L48-94

vex
export fn test_poly1305_rfc7539(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_poly1305_rfc8439_a3 🔓 export ​

📄 poly1305.test.vx L96-165

vex
export fn test_poly1305_rfc8439_a3(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_poly1305_streaming_partitions_match_one_shot 🔓 export ​

📄 poly1305.test.vx L167-201

vex
export fn test_poly1305_streaming_partitions_match_one_shot(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha256_empty 🔓 export ​

📄 sha256.test.vx L4-8

vex
export fn test_sha256_empty(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha256_abc 🔓 export ​

📄 sha256.test.vx L10-14

vex
export fn test_sha256_abc(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha256_snapshot_does_not_finalize_state 🔓 export ​

📄 sha256.test.vx L16-32

vex
export fn test_sha256_snapshot_does_not_finalize_state(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha384_empty 🔓 export ​

📄 sha512.test.vx L4-11

vex
export fn test_sha384_empty(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha384_abc 🔓 export ​

📄 sha512.test.vx L13-20

vex
export fn test_sha384_abc(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha384_snapshot_does_not_finalize_state 🔓 export ​

📄 sha512.test.vx L22-40

vex
export fn test_sha384_snapshot_does_not_finalize_state(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha512_empty 🔓 export ​

📄 sha512.test.vx L42-49

vex
export fn test_sha512_empty(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha512_abc 🔓 export ​

📄 sha512.test.vx L51-58

vex
export fn test_sha512_abc(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_sha512_check 🔓 export ​

📄 test_sha.test.vx L5-33

vex
export fn test_sha512_check(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

xSpan ​

📄 x25519.test.vx L4-6

vex
fn xSpan<const N: usize>(value: &[u8; N]): Span<u8>

Type Parameters:

  • const N: usize

Parameters:

NameType
value&[u8; N]

Returns: Span<u8>


test_x25519_rfc7748 🔓 export ​

📄 x25519.test.vx L8-31

vex
export fn test_x25519_rfc7748(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_x25519_basepoint_bob 🔓 export ​

📄 x25519.test.vx L33-54

vex
export fn test_x25519_basepoint_bob(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_x25519_agreement 🔓 export ​

📄 x25519.test.vx L56-79

vex
export fn test_safe_x25519_agreement(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_safe_x25519_rejects_non_contributory_peer 🔓 export ​

📄 x25519.test.vx L81-100

vex
export fn test_safe_x25519_rejects_non_contributory_peer(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_x25519_caller_owned_to_api_is_allocation_free_and_exact 🔓 export ​

📄 x25519.test.vx L102-146

vex
export fn test_x25519_caller_owned_to_api_is_allocation_free_and_exact(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

test_x25519_to_api_rejects_alias_and_zeroes_low_order_output 🔓 export ​

📄 x25519.test.vx L148-181

vex
export fn test_x25519_to_api_rejects_alias_and_zeroes_low_order_output(ctx: &TestCtx!)

Parameters:

NameType
ctx&TestCtx!

Methods ​

ChaCha20Poly1305.sealDetachedInto 🔓 export ​

📄 api.vx L93-143

vex
export fn ChaCha20Poly1305.sealDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>

Encrypt into caller-reusable storage and return a detached 128-bit tag.

Source/output overlap is staged before any resize; output is empty on error.

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>
output&Vec<u8>!

Returns: Result<[u8; 16], CryptoError>


ChaCha20Poly1305.openDetachedInto 🔓 export ​

📄 api.vx L147-199

vex
export fn ChaCha20Poly1305.openDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Authenticate before releasing plaintext into caller-reusable storage.

The output is securely erased and emptied on every failure.

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
ciphertextSpan<u8>
tagSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


ChaCha20Poly1305.sealInto 🔓 export ​

📄 api.vx L202-224

vex
export fn ChaCha20Poly1305.sealInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Encrypt to the conventional ciphertext || tag representation.

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


ChaCha20Poly1305.openInto 🔓 export ​

📄 api.vx L227-247

vex
export fn ChaCha20Poly1305.openInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Open a conventional ciphertext || tag value.

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
sealedSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


ChaCha20Poly1305.seal 🔓 export ​

📄 api.vx L249-257

vex
export fn ChaCha20Poly1305.seal(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>): Result<Vec<u8>, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>

Returns: Result<Vec<u8>, CryptoError>


ChaCha20Poly1305.open 🔓 export ​

📄 api.vx L259-267

vex
export fn ChaCha20Poly1305.open(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>): Result<Vec<u8>, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
sealedSpan<u8>

Returns: Result<Vec<u8>, CryptoError>


Aes256Gcm.sealDetachedInto 🔓 export ​

📄 api.vx L405-409

vex
export fn Aes256Gcm.sealDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>

AES-256-GCM detached encryption with the checked/reusable contract.

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>
output&Vec<u8>!

Returns: Result<[u8; 16], CryptoError>


Aes256Gcm.openDetachedInto 🔓 export ​

📄 api.vx L411-418

vex
export fn Aes256Gcm.openDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
ciphertextSpan<u8>
tagSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Aes256Gcm.sealInto 🔓 export ​

📄 api.vx L420-438

vex
export fn Aes256Gcm.sealInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Aes256Gcm.openInto 🔓 export ​

📄 api.vx L440-454

vex
export fn Aes256Gcm.openInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
sealedSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Aes256Gcm.seal 🔓 export ​

📄 api.vx L456-464

vex
export fn Aes256Gcm.seal(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>): Result<Vec<u8>, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>

Returns: Result<Vec<u8>, CryptoError>


Aes256Gcm.open 🔓 export ​

📄 api.vx L466-474

vex
export fn Aes256Gcm.open(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>): Result<Vec<u8>, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
sealedSpan<u8>

Returns: Result<Vec<u8>, CryptoError>


Aes128Gcm.sealDetachedInto 🔓 export ​

📄 api.vx L477-481

vex
export fn Aes128Gcm.sealDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<[u8; 16], CryptoError>

AES-128-GCM detached encryption for protocols such as TLS 1.3.

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
plaintextSpan<u8>
output&Vec<u8>!

Returns: Result<[u8; 16], CryptoError>


Aes128Gcm.openDetachedInto 🔓 export ​

📄 api.vx L483-490

vex
export fn Aes128Gcm.openDetachedInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, ciphertext: Span<u8>, tag: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
keySpan<u8>
nonceSpan<u8>
aadSpan<u8>
ciphertextSpan<u8>
tagSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Aes128Gcm.sealInto 🔓 export ​

📄 api.vx L492-510

vex
export fn Aes128Gcm.sealInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Usage contract: The combined result is ciphertext followed by the tag; it does not contain the nonce. Keep nonce allocation and key lifetime at the application boundary. See AEAD nonce lifecycle.

Parameters:

NameTypeDescription
keySpan<u8>Exactly 16 borrowed key bytes
nonceSpan<u8>Exactly 12 borrowed nonce bytes; unique for every encryption under this key
aadSpan<u8>Borrowed associated data; identical bytes must be supplied when opening
plaintextSpan<u8>Borrowed plaintext bytes; owners remain live for the call
output&Vec<u8>!Reusable owning destination; replaced with ciphertext followed by a 16-byte tag

Returns: Result<usize, CryptoError>


Aes128Gcm.openInto 🔓 export ​

📄 api.vx L512-526

vex
export fn Aes128Gcm.openInto(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Usage contract: Only a successful result authenticates and releases plaintext. A valid tag does not itself enforce replay policy. Inputs are borrowed; the successful owning output can outlive them.

Parameters:

NameTypeDescription
keySpan<u8>Exactly 16 borrowed key bytes
nonceSpan<u8>Exactly 12 borrowed nonce bytes; unique for every encryption under this key
aadSpan<u8>Borrowed associated data; identical bytes must be supplied when opening
sealedSpan<u8>Combined ciphertext followed by a 16-byte tag; at least 16 bytes
output&Vec<u8>!Reusable plaintext destination; failure clears its logical sensitive output

Returns: Result<usize, CryptoError>


Aes128Gcm.seal 🔓 export ​

📄 api.vx L528-536

vex
export fn Aes128Gcm.seal(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, plaintext: Span<u8>): Result<Vec<u8>, CryptoError>

Usage contract: The combined result is ciphertext followed by the tag; it does not contain the nonce. Keep nonce allocation and key lifetime at the application boundary. See AEAD nonce lifecycle.

Parameters:

NameTypeDescription
keySpan<u8>Exactly 16 borrowed key bytes
nonceSpan<u8>Exactly 12 borrowed nonce bytes; unique for every encryption under this key
aadSpan<u8>Borrowed associated data; identical bytes must be supplied when opening
plaintextSpan<u8>Borrowed plaintext bytes; owners remain live for the call

Returns: Result<Vec<u8>, CryptoError>


Aes128Gcm.open 🔓 export ​

📄 api.vx L538-546

vex
export fn Aes128Gcm.open(key: Span<u8>, nonce: Span<u8>, aad: Span<u8>, sealed: Span<u8>): Result<Vec<u8>, CryptoError>

Usage contract: Only a successful result authenticates and releases plaintext. A valid tag does not itself enforce replay policy. Inputs are borrowed; the successful owning output can outlive them.

Parameters:

NameTypeDescription
keySpan<u8>Exactly 16 borrowed key bytes
nonceSpan<u8>Exactly 12 borrowed nonce bytes; unique for every encryption under this key
aadSpan<u8>Borrowed associated data; identical bytes must be supplied when opening
sealedSpan<u8>Combined ciphertext followed by a 16-byte tag; at least 16 bytes

Returns: Result<Vec<u8>, CryptoError>


HkdfSha256.extract 🔓 export ​

📄 api.vx L549-565

vex
export fn HkdfSha256.extract(salt: Span<u8>, inputKeyMaterial: Span<u8>): Result<[u8; 32], CryptoError>

Extract a fixed 32-byte pseudorandom key without exposing raw pointers.

Parameters:

NameType
saltSpan<u8>
inputKeyMaterialSpan<u8>

Returns: Result<[u8; 32], CryptoError>


HkdfSha256.expandInto 🔓 export ​

📄 api.vx L569-600

vex
export fn HkdfSha256.expandInto(prk: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

Expand a 32-byte PRK into caller-reusable storage. RFC 5869's 8160-byte

maximum is enforced before allocation or output mutation.

Parameters:

NameType
prkSpan<u8>
infoSpan<u8>
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


HkdfSha256.deriveInto 🔓 export ​

📄 api.vx L603-636

vex
export fn HkdfSha256.deriveInto(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

One-shot HKDF-SHA256 derivation into caller-reusable storage.

Parameters:

NameType
saltSpan<u8>
inputKeyMaterialSpan<u8>
infoSpan<u8>
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


HkdfSha256.derive 🔓 export ​

📄 api.vx L638-646

vex
export fn HkdfSha256.derive(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize): Result<Vec<u8>, CryptoError>

Usage contract: Returns an independent owning byte vector. Length failure is typed; use distinct context values for distinct protocol purposes. See HKDF guidance.

Parameters:

NameTypeDescription
saltSpan<u8>Borrowed HKDF salt bytes
inputKeyMaterialSpan<u8>Borrowed input keying material; this is not a password-stretching API
infoSpan<u8>Borrowed protocol-purpose/context bytes
outputLengthusizeRequested bytes, at most 8160 (255 SHA-256 digest blocks)

Returns: Result<Vec<u8>, CryptoError>


HkdfSha384.extract 🔓 export ​

📄 api.vx L649-665

vex
export fn HkdfSha384.extract(salt: Span<u8>, inputKeyMaterial: Span<u8>): Result<[u8; 48], CryptoError>

Extract a fixed 48-byte SHA-384 pseudorandom key through safe spans.

Parameters:

NameType
saltSpan<u8>
inputKeyMaterialSpan<u8>

Returns: Result<[u8; 48], CryptoError>


HkdfSha384.expandInto 🔓 export ​

📄 api.vx L669-697

vex
export fn HkdfSha384.expandInto(prk: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

Expand a 48-byte PRK into caller-reusable storage. RFC 5869's 12240-byte

SHA-384 maximum is enforced before allocation or output mutation.

Parameters:

NameType
prkSpan<u8>
infoSpan<u8>
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


HkdfSha384.deriveInto 🔓 export ​

📄 api.vx L699-733

vex
export fn HkdfSha384.deriveInto(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

Parameters:

NameType
saltSpan<u8>
inputKeyMaterialSpan<u8>
infoSpan<u8>
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


HkdfSha384.derive 🔓 export ​

📄 api.vx L735-745

vex
export fn HkdfSha384.derive(salt: Span<u8>, inputKeyMaterial: Span<u8>, info: Span<u8>, outputLength: usize): Result<Vec<u8>, CryptoError>

Parameters:

NameType
saltSpan<u8>
inputKeyMaterialSpan<u8>
infoSpan<u8>
outputLengthusize

Returns: Result<Vec<u8>, CryptoError>


Pbkdf2Sha256.deriveInto 🔓 export ​

📄 api.vx L750-788

vex
export fn Pbkdf2Sha256.deriveInto(password: Span<u8>, salt: Span<u8>, iterations: u64, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

PBKDF2-HMAC-SHA256 into reusable storage. Iteration count and RFC output

block limit are validated before output mutation; all intermediate U/T blocks are securely erased by the kernel.

Parameters:

NameType
passwordSpan<u8>
saltSpan<u8>
iterationsu64
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Pbkdf2Sha256.derive 🔓 export ​

📄 api.vx L790-798

vex
export fn Pbkdf2Sha256.derive(password: Span<u8>, salt: Span<u8>, iterations: u64, outputLength: usize): Result<Vec<u8>, CryptoError>

Parameters:

NameType
passwordSpan<u8>
saltSpan<u8>
iterationsu64
outputLengthusize

Returns: Result<Vec<u8>, CryptoError>


X25519.publicKeyTo 🔓 export ​

📄 api.vx L801-828

vex
export fn X25519.publicKeyTo(privateKey: Span<u8>, output: &Span<u8>!): Result<usize, CryptoError>

Derive an X25519 public key from an exact 32-byte private scalar.

Parameters:

NameType
privateKeySpan<u8>
output&Span<u8>!

Returns: Result<usize, CryptoError>


X25519.publicKeyInto 🔓 export ​

📄 api.vx L831-848

vex
export fn X25519.publicKeyInto(privateKey: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Derive an X25519 public key into reusable owned storage.

Parameters:

NameType
privateKeySpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


X25519.publicKey 🔓 export ​

📄 api.vx L850-864

vex
export fn X25519.publicKey(privateKey: Span<u8>): Result<[u8; 32], CryptoError>

Parameters:

NameType
privateKeySpan<u8>

Returns: Result<[u8; 32], CryptoError>


X25519.sharedSecretTo 🔓 export ​

📄 api.vx L871-922

vex
export fn X25519.sharedSecretTo(privateKey: Span<u8>, peerPublicKey: Span<u8>, output: &Span<u8>!): Result<usize, CryptoError>

Usage contract: Returns 32 on success. The all-zero shared result clears the destination and returns InvalidPublicKey. Dimension/overlap checks run before the operation; the raw span still requires valid live backing storage. X25519 alone does not authenticate the peer.

Compute a contributory X25519 shared secret. RFC 7748 permits callers to

reject an all-zero result; this safe API always rejects it in constant time so low-order public keys cannot silently collapse the handshake secret. The caller-owned output is exact-width, allocation-free, and zeroed before returning InvalidPublicKey for a non-contributory peer.

Parameters:

NameTypeDescription
privateKeySpan<u8>Exactly 32 readable private-scalar bytes
peerPublicKeySpan<u8>Exactly 32 readable peer-key bytes
output&Span<u8>!Exactly 32 writable bytes; must overlap neither input

Returns: Result<usize, CryptoError>


X25519.sharedSecretInto 🔓 export ​

📄 api.vx L925-956

vex
export fn X25519.sharedSecretInto(privateKey: Span<u8>, peerPublicKey: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Compute a contributory X25519 shared secret into reusable owned storage.

Parameters:

NameType
privateKeySpan<u8>
peerPublicKeySpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


X25519.sharedSecret 🔓 export ​

📄 api.vx L958-970

vex
export fn X25519.sharedSecret(privateKey: Span<u8>, peerPublicKey: Span<u8>): Result<[u8; 32], CryptoError>

Parameters:

NameType
privateKeySpan<u8>
peerPublicKeySpan<u8>

Returns: Result<[u8; 32], CryptoError>


Ed25519.publicKey 🔓 export ​

📄 api.vx L973-987

vex
export fn Ed25519.publicKey(privateSeed: Span<u8>): Result<[u8; 32], CryptoError>

Derive the RFC 8032 public key for an exact 32-byte private seed.

Parameters:

NameType
privateSeedSpan<u8>

Returns: Result<[u8; 32], CryptoError>


Ed25519.signInto 🔓 export ​

📄 api.vx L991-1024

vex
export fn Ed25519.signInto(privateSeed: Span<u8>, message: Span<u8>, output: &Vec<u8>!): Result<usize, CryptoError>

Deterministically sign a message into caller-reusable storage. The private

seed and message may alias the output; both are staged before resize.

Parameters:

NameType
privateSeedSpan<u8>
messageSpan<u8>
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Ed25519.sign 🔓 export ​

📄 api.vx L1026-1052

vex
export fn Ed25519.sign(privateSeed: Span<u8>, message: Span<u8>): Result<[u8; 64], CryptoError>

Parameters:

NameType
privateSeedSpan<u8>
messageSpan<u8>

Returns: Result<[u8; 64], CryptoError>


Ed25519.verify 🔓 export ​

📄 api.vx L1057-1089

vex
export fn Ed25519.verify(publicKey: Span<u8>, message: Span<u8>, signature: Span<u8>): Result<bool, CryptoError>

Usage contract: Accept only Ok(true). Ok(false) means signature rejection; invalid dimensions produce a typed error. Public-key identity/trust is a separate application responsibility.

Strict verification: canonical encodings, canonical S, and non-small-order

R/public-key points are required. Dimension errors are typed; a well-formed but invalid signature returns Ok(false).

Parameters:

NameTypeDescription
publicKeySpan<u8>Exactly 32 borrowed Ed25519 public-key bytes
messageSpan<u8>Borrowed message bytes; no mutation or retention
signatureSpan<u8>Exactly 64 borrowed signature bytes

Returns: Result<bool, CryptoError>


Argon2Parameters.new 🔓 export ​

📄 argon2id.vx L762-772

vex
export fn Argon2Parameters.new(timeCost: u64, memoryKiB: u64, parallelism: u64): Argon2Parameters

Parameters:

NameType
timeCostu64
memoryKiBu64
parallelismu64

Returns: Argon2Parameters


📄 argon2id.vx L777-779

vex
export fn Argon2Parameters.recommended(): Argon2Parameters

RFC 9106's memory-constrained recommendation: 64 MiB, three passes and

four lanes. Applications should benchmark and increase memory when their deployment budget permits it.

Returns: Argon2Parameters


Argon2id.deriveInto 🔓 export ​

📄 argon2id.vx L827-843

vex
export fn Argon2id.deriveInto(password: Span<u8>, salt: Span<u8>, parameters: Argon2Parameters, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

Derive into caller-reusable storage. Input/output aliases are staged before

Vec growth and every failure leaves output empty and securely erased.

Parameters:

NameType
passwordSpan<u8>
saltSpan<u8>
parametersArgon2Parameters
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Argon2id.deriveExInto 🔓 export ​

📄 argon2id.vx L847-907

vex
export fn Argon2id.deriveExInto(password: Span<u8>, salt: Span<u8>, secret: Span<u8>, associatedData: Span<u8>, parameters: Argon2Parameters, outputLength: usize, output: &Vec<u8>!): Result<usize, CryptoError>

RFC 9106 extended derivation with an optional secret (pepper) and

associated data. The secret is mixed into H0 and is never copied to output.

Parameters:

NameType
passwordSpan<u8>
saltSpan<u8>
secretSpan<u8>
associatedDataSpan<u8>
parametersArgon2Parameters
outputLengthusize
output&Vec<u8>!

Returns: Result<usize, CryptoError>


Argon2id.derive 🔓 export ​

📄 argon2id.vx L909-920

vex
export fn Argon2id.derive(password: Span<u8>, salt: Span<u8>, parameters: Argon2Parameters, outputLength: usize): Result<Vec<u8>, CryptoError>

Parameters:

NameType
passwordSpan<u8>
saltSpan<u8>
parametersArgon2Parameters
outputLengthusize

Returns: Result<Vec<u8>, CryptoError>


Argon2id.deriveEx 🔓 export ​

📄 argon2id.vx L922-937

vex
export fn Argon2id.deriveEx(password: Span<u8>, salt: Span<u8>, secret: Span<u8>, associatedData: Span<u8>, parameters: Argon2Parameters, outputLength: usize): Result<Vec<u8>, CryptoError>

Parameters:

NameType
passwordSpan<u8>
saltSpan<u8>
secretSpan<u8>
associatedDataSpan<u8>
parametersArgon2Parameters
outputLengthusize

Returns: Result<Vec<u8>, CryptoError>


CryptoError.new 🔓 export ​

📄 contracts.vx L25-31

vex
export fn CryptoError.new(kind: CryptoErrorKind, requested: u64, limit: u64): CryptoError

Parameters:

NameType
kindCryptoErrorKind
requestedu64
limitu64

Returns: CryptoError


message 🔓 export ​

📄 contracts.vx L33-46

vex
export fn (self: &CryptoError) message(): str

Receiver: self: &CryptoError (immutable reference)

Returns: str


Digest32.reset ​

📄 contracts.vx L49-49

vex
reset()!;

This is the reset requirement of Digest32, not a free function.


Digest32.update ​

📄 contracts.vx L50-50

vex
update(data: str)!;

This is the update requirement of Digest32, not a free function.

Parameters:

NameType
datastr

Digest32.updateRaw ​

📄 contracts.vx L51-51

vex
updateRaw(data: RawBuf, len: u64)!;

This is the updateRaw requirement of Digest32, not a free function.

Parameters:

NameType
dataRawBuf
lenu64

Digest32.sum ​

📄 contracts.vx L52-52

vex
sum(out: Ptr<u8>, out_len: u64)!;

This is the sum requirement of Digest32, not a free function.

Parameters:

NameType
outPtr<u8>
out_lenu64

Mac32.reset ​

📄 contracts.vx L56-56

vex
reset()!;

This is the reset requirement of Mac32, not a free function.


Mac32.update ​

📄 contracts.vx L57-57

vex
update(data: str)!;

This is the update requirement of Mac32, not a free function.

Parameters:

NameType
datastr

Mac32.updateRaw ​

📄 contracts.vx L58-58

vex
updateRaw(data: RawBuf, len: u64)!;

This is the updateRaw requirement of Mac32, not a free function.

Parameters:

NameType
dataRawBuf
lenu64

Mac32.final ​

📄 contracts.vx L59-59

vex
final(out: Ptr<u8>, out_len: u64)!;

This is the final requirement of Mac32, not a free function.

Parameters:

NameType
outPtr<u8>
out_lenu64

Poly1305.new 🔓 export ​

📄 poly1305.vx L21-67

vex
export fn Poly1305.new(key: RawBuf, key_len: usize): Poly1305

Parameters:

NameType
keyRawBuf
key_lenusize

Returns: Poly1305


update 🔓 export ​

📄 poly1305.vx L75-117

vex
export fn (self: &Poly1305!) update(data: RawBuf, len: usize)

Receiver: self: &Poly1305! (mutable reference)

Parameters:

NameType
dataRawBuf
lenusize

processBufferedBlock ​

📄 poly1305.vx L119-126

vex
fn (self: &Poly1305!) processBufferedBlock(hibit: u32)

Receiver: self: &Poly1305! (mutable reference)

Parameters:

NameType
hibitu32

processDataBlock ​

📄 poly1305.vx L128-134

vex
fn (self: &Poly1305!) processDataBlock(data: RawBuf, offset: usize)

Receiver: self: &Poly1305! (mutable reference)

Parameters:

NameType
dataRawBuf
offsetusize

processWords ​

📄 poly1305.vx L137-197

vex
fn (self: &Poly1305!) processWords(t0: u32, t1: u32, t2: u32, t3: u32, hibit: u32)

Receiver: self: &Poly1305! (mutable reference)

Parameters:

NameType
t0u32
t1u32
t2u32
t3u32
hibitu32

finalize 🔓 export ​

📄 poly1305.vx L200-315

vex
export fn (self: &Poly1305!) finalize(): [u8; 16]

Receiver: self: &Poly1305! (mutable reference)

Returns: [u8; 16]


Sha1.new 🔓 export ​

📄 sha1.vx L14-32

vex
export fn Sha1.new(): Sha1

Returns: Sha1


processBlock ​

📄 sha1.vx L39-112

vex
fn (self: &Sha1!) processBlock(block: RawBuf)

Receiver: self: &Sha1! (mutable reference)

Parameters:

NameType
blockRawBuf

reset 🔓 export ​

📄 sha1.vx L114-122

vex
export fn (self: &Sha1!) reset()!

Receiver: self: &Sha1! (mutable reference)


update 🔓 export ​

📄 sha1.vx L124-126

vex
export fn (self: &Sha1!) update(data: str)

Receiver: self: &Sha1! (mutable reference)

Parameters:

NameType
datastr

updateRaw 🔓 export ​

📄 sha1.vx L128-143

vex
export fn (self: &Sha1!) updateRaw(data: RawBuf, len: u64)

Receiver: self: &Sha1! (mutable reference)

Parameters:

NameType
dataRawBuf
lenu64

sum 🔓 export ​

📄 sha1.vx L145-188

vex
export fn (self: &Sha1!) sum(out: Ptr<u8>, out_len: u64)!

Receiver: self: &Sha1! (mutable reference)

Parameters:

NameType
outPtr<u8>
out_lenu64

Sha256.new 🔓 export ​

📄 sha256.vx L41-62

vex
export fn Sha256.new(): Sha256

Returns: Sha256


processBlock ​

📄 sha256.vx L69-128

vex
fn (self: &Sha256!) processBlock(block: RawBuf, offset: usize)

Receiver: self: &Sha256! (mutable reference)

Parameters:

NameType
blockRawBuf
offsetusize

reset 🔓 export ​

📄 sha256.vx L130-141

vex
export fn (self: &Sha256!) reset()!

Receiver: self: &Sha256! (mutable reference)


update 🔓 export ​

📄 sha256.vx L143-145

vex
export fn (self: &Sha256!) update(data: str)

Receiver: self: &Sha256! (mutable reference)

Parameters:

NameType
datastr

updateRaw 🔓 export ​

📄 sha256.vx L147-175

vex
export fn (self: &Sha256!) updateRaw(data: RawBuf, len: u64)

Receiver: self: &Sha256! (mutable reference)

Parameters:

NameType
dataRawBuf
lenu64

sum 🔓 export ​

📄 sha256.vx L177-220

vex
export fn (self: &Sha256!) sum(out: Ptr<u8>, out_len: u64)!

Receiver: self: &Sha256! (mutable reference)

Parameters:

NameType
outPtr<u8>
out_lenu64

snapshotTo 🔓 export ​

📄 sha256.vx L228-243

vex
export fn (self: &Sha256) snapshotTo(out: Ptr<u8>, outLen: u64): bool

Writes the digest of the current state without consuming or finalizing it.

Hash-state cloning is deliberately explicit instead of making Sha256Copy: callers can take protocol snapshots without enabling accidental silent duplication of cryptographic state. The temporary state is erased before this function returns.

Receiver: self: &Sha256 (immutable reference)

Parameters:

NameType
outPtr<u8>
outLenu64

Returns: bool


Sha512.new 🔓 export ​

📄 sha512.vx L81-85

vex
export fn Sha512.new(): Sha512

Returns: Sha512


init 🔓 export ​

📄 sha512.vx L87-105

vex
export fn (self: &Sha512!) init()

Receiver: self: &Sha512! (mutable reference)


init384 ​

📄 sha512.vx L107-125

vex
fn (self: &Sha512!) init384()

Receiver: self: &Sha512! (mutable reference)


Sha384.new 🔓 export ​

📄 sha512.vx L127-131

vex
export fn Sha384.new(): Sha384

Returns: Sha384


processBlock512 ​

📄 sha512.vx L133-189

vex
fn (self: &Sha512!) processBlock512(block: RawBuf, offset: usize)

Receiver: self: &Sha512! (mutable reference)

Parameters:

NameType
blockRawBuf
offsetusize

update512 🔓 export ​

📄 sha512.vx L191-193

vex
export fn (self: &Sha512!) update512(data: str)

Receiver: self: &Sha512! (mutable reference)

Parameters:

NameType
datastr

updateRaw512 🔓 export ​

📄 sha512.vx L195-226

vex
export fn (self: &Sha512!) updateRaw512(data: RawBuf, len: u64)

Receiver: self: &Sha512! (mutable reference)

Parameters:

NameType
dataRawBuf
lenu64

sum512Family ​

📄 sha512.vx L228-282

vex
fn (self: &Sha512!) sum512Family(out: Ptr<u8>, outLen: u64, digestLen: u64)

Receiver: self: &Sha512! (mutable reference)

Parameters:

NameType
outPtr<u8>
outLenu64
digestLenu64

sum512 🔓 export ​

📄 sha512.vx L284-286

vex
export fn (self: &Sha512!) sum512(out: Ptr<u8>, outLen: u64)

Receiver: self: &Sha512! (mutable reference)

Parameters:

NameType
outPtr<u8>
outLenu64

update384 🔓 export ​

📄 sha512.vx L288-290

vex
export fn (self: &Sha384!) update384(data: str)

Receiver: self: &Sha384! (mutable reference)

Parameters:

NameType
datastr

updateRaw384 🔓 export ​

📄 sha512.vx L292-294

vex
export fn (self: &Sha384!) updateRaw384(data: RawBuf, len: u64)

Receiver: self: &Sha384! (mutable reference)

Parameters:

NameType
dataRawBuf
lenu64

sum384 🔓 export ​

📄 sha512.vx L296-298

vex
export fn (self: &Sha384!) sum384(out: Ptr<u8>, outLen: u64)

Receiver: self: &Sha384! (mutable reference)

Parameters:

NameType
outPtr<u8>
outLenu64

reset384 🔓 export ​

📄 sha512.vx L301-303

vex
export fn (self: &Sha384!) reset384()

Resets a SHA-384 state to its FIPS 180-4 initial value.

Receiver: self: &Sha384! (mutable reference)


snapshotTo 🔓 export ​

📄 sha512.vx L307-322

vex
export fn (self: &Sha384) snapshotTo(out: Ptr<u8>, outLen: u64): bool

Writes the digest of the current state without consuming or finalizing it.

The explicitly cloned temporary state is erased before returning.

Receiver: self: &Sha384 (immutable reference)

Parameters:

NameType
outPtr<u8>
outLenu64

Returns: bool



Generated by vex-doc v2.0 • 2026-10-28

Released under the MIT License.