package core:crypto

⌘K
Ctrl+K
or
/

    Overview

    A selection of cryptography algorithms and useful helper routines.

    Packages 34

    aeadA generic interface to Authenticated Encryption with Associated Data (AEAD) algorithms.
    aegisAEGIS-128L and AEGIS-256 AEAD algorithms.
    aesThe AES block cipher and some common modes.
    argon2idpackage argon2id implements the Argon2id password hashing algorithm.
    blake2bBLAKE2b hash algorithm.
    blake2sBLAKE2s hash algorithm.
    chacha20ChaCha20 and XChaCha20 stream ciphers.
    chacha20poly1305AEAD_CHACHA20_POLY1305 and AEAD_XChaCha20_Poly1305 algorithms.
    deoxysiiDeoxys-II-256 Authenticated Encryption with Additional Data (AEAD) algorithm.
    ecdhA generic interface to Elliptic Curve Diffie-Hellman key exchange.
    ecdsaElliptic Curve Digital Signature Algorithm per SEC 2.0 section 4.1.
    ed25519Ed25519 EdDSA signature algorithm.
    hashA generic interface to the supported hash algorithms.
    hkdfHKDF HMAC-based Extract-and-Expand Key Derivation Function.
    hmacHMAC message authentication code (MAC) algorithm.
    kmacKMAC message authentication code (MAC) algorithm.
    legacy/keccakKeccak hash algorithm family.
    legacy/md5MD5 hash algorithm.
    legacy/sha1SHA1 hash algorithm.
    mldsaModule-Lattice-Based Digital Signature Algorithm.
    mlkemML-KEM Module-Lattice-Based Key-Encapsulation Mechanism.
    noiseAn implementation of the Noise Protocol Framework (Revision 34).
    pbkdf2PBKDF2 password-based key derivation function.
    poly1305Poly1305 one-time MAC algorithm.
    ristretto255Ristretto255 prime-order group.
    rsaRSA (Rivest–Shamir–Adleman) cryptosystem.
    sha2SHA2 hash algorithm family.
    sha3SHA3 hash algorithm family.
    shakeSHAKE and cSHAKE XOF algorithm families.
    sm3SM3 hash algorithm.
    tuplehashTupleHash and TupleHashXOF algorithms.
    x25519X25519 (aka curve25519) Elliptic-Curve Diffie-Hellman key exchange protocol.
    x448X448 (aka curve448) Elliptic-Curve Diffie-Hellman key exchange protocol.
    x509X.509 v3 certificate parsing, signature verification, and chain (path)

    Index

    Types (0)

    This section is empty.

    Variables (0)

    This section is empty.

    Procedure Groups (0)

    This section is empty.

    `#config` values (1)

    Types

    This section is empty.

    Constants

    COMPACT_IMPLS ¶

    COMPACT_IMPLS: bool : #config(ODIN_CRYPTO_COMPACT, false)
    -define:ODIN_CRYPTO_COMPACT=false
     

    Omit large precomputed tables, trading off performance for size.

    HAS_RAND_BYTES ¶

    HAS_RAND_BYTES :: runtime.HAS_RAND_BYTES
     

    HAS_RAND_BYTES is true iff the runtime provides a cryptographic entropy source.

    Variables

    This section is empty.

    Procedures

    compare_byte_ptrs_constant_time ¶

    @(optimization_mode="none")
    compare_byte_ptrs_constant_time :: proc "contextless" (a, b: ^u8, n: int) -> int {…}
     

    compare_byte_ptrs_constant_time returns 1 iff the bytes pointed to by a and b are equal, 0 otherwise.

    The execution time of this routine is constant regardless of the contents of the memory being compared.

    compare_constant_time ¶

    compare_constant_time :: proc "contextless" (a, b: []u8) -> int {…}
     

    compare_constant_time returns 1 iff a and b are equal, 0 otherwise.

    The execution time of this routine is constant regardless of the contents of the slices being compared, as long as the length of the slices is equal. iff the length of the two slices is diferent, it will early-return 0.

    is_zero_constant_time ¶

    is_zero_constant_time :: proc "contextless" (b: []u8) -> int {…}
     

    is_zero_constant_time returns 1 iff b is all 0s, 0 otherwise.

    rand_bytes ¶

    rand_bytes :: proc(dst: []u8) {…}
     

    rand_bytes fills the dst buffer with cryptographic entropy taken from the system entropy source. This routine will block if the system entropy source is not ready yet. All system entropy source failures are treated as catastrophic, resulting in a panic.

    Support for the system entropy source can be checked with the HAS_RAND_BYTES boolean constant.

    random_generator ¶

    random_generator :: proc() -> runtime.Random_Generator {…}
     

    random_generator returns a runtime.Random_Generator backed by the system entropy source.

    Support for the system entropy source can be checked with the HAS_RAND_BYTES boolean constant.

    zero_explicit ¶

    zero_explicit :: proc "contextless" (data: rawptr, len: int) -> rawptr {…}
     

    Set each byte of a memory range to zero.

    This procedure copies the value 0 into the len bytes of a memory range, starting at address data.

    This procedure returns the pointer to data.

    Unlike the zero() procedure, which can be optimized away or reordered by the compiler under certain circumstances, zero_explicit() procedure can not be optimized away or reordered with other memory access operations, and the compiler assumes volatile semantics of the memory.

    Procedure Groups

    This section is empty.

    `#config` values

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-12 23:46:18.383355400 +0000 UTC