ddn.api.crypto.common

Common definitions, exceptions, and utility functions for the DDN Crypto API.

Types 2

classCryptoException : Exception

Base exception for all crypto-related errors in the DDN Crypto API.

enumAlgorithm : string

Standard cryptographic algorithm name constants.

Use these instead of raw strings for discoverability and consistency.

AES = "AES"
AES_128 = "AES-128"
AES_192 = "AES-192"
AES_256 = "AES-256"
CHACHA20 = "ChaCha20"
CHACHA20_POLY1305 = "ChaCha20-Poly1305"
MD5 = "MD5"Warning: MD5 is cryptographically broken and should not be used for security purposes. Use SHA-256 or stronger.
SHA1 = "SHA-1"Warning: SHA-1 is cryptographically broken and should not be used for security purposes. Use SHA-256 or stronger.
SHA256 = "SHA-256"
SHA512 = "SHA-512"
SHA3_256 = "SHA3-256"
SHA3_512 = "SHA3-512"
BLAKE2B = "BLAKE2b"
BLAKE2S = "BLAKE2s"
BLAKE3 = "BLAKE3"
HMAC_SHA256 = "HMAC-SHA-256"
HMAC_SHA512 = "HMAC-SHA-512"
POLY1305 = "Poly1305"
RSA = "RSA"
ECDSA = "ECDSA"
ED25519 = "Ed25519"
X25519 = "X25519"
X448 = "X448"
DH = "DH"
PBKDF2 = "PBKDF2"
HKDF = "HKDF"
ARGON2ID = "Argon2id"

Functions 3

fnbool safeEqual(const(ubyte)[] a, const(ubyte)[] b) @safe pure nothrow @nogcPerforms a constant-time comparison of two byte arrays to prevent timing attacks.
fnvoid secureZero(ubyte[] data) nothrow @nogc @trustedSecurely zeros a byte array, preventing the compiler from optimizing away the operation.
fnsize_t hashCombine(size_t seed, const(ubyte)[] data) pure nothrow @nogc @safeCombines a hash seed with raw bytes using a polynomial rolling hash.