Computes the MD5 digest of data.
MD5 is considered cryptographically broken. Use it only for non-security purposes such as checksums or legacy compatibility.
@eryx/crypto/hash ModuleCryptographic hash functions.
All functions take a buffer and return the raw digest as a buffer.
For hex output, pipe through @eryx/encoding/hex.
local hash = require("@eryx/crypto/hash")
local hex = require("@eryx/encoding/hex")
print(hex.encode(hash.sha256(buffer.fromstring("hello"))))
-- "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
Computes the MD5 digest of data.
MD5 is considered cryptographically broken. Use it only for non-security purposes such as checksums or legacy compatibility.
Input data.
16-byte (128-bit) digest.
Computes the SHA-1 digest of data.
SHA-1 is deprecated for security-critical uses. Prefer SHA-256 or SHA-3 for new designs.
Input data.
20-byte (160-bit) digest.
Computes the SHA-224 digest of data.
Input data.
28-byte (224-bit) digest.
Computes the SHA-256 digest of data.
The most widely deployed secure hash. Suitable for signatures, HMACs, key derivation, and general-purpose integrity checking.
Input data.
32-byte (256-bit) digest.
Computes the SHA-384 digest of data.
Input data.
48-byte (384-bit) digest.
Computes the SHA-512 digest of data.
Provides 512-bit security strength. Preferred over SHA-256 when output size matters less than collision resistance.
Input data.
64-byte (512-bit) digest.
Computes the SHA3-224 digest of data.
SHA-3 is based on the Keccak sponge construction, an entirely different design from SHA-2. Resistant to length-extension attacks.
Input data.
28-byte (224-bit) digest.
Computes the SHA3-256 digest of data.
Input data.
32-byte (256-bit) digest.
Computes the SHA3-384 digest of data.
Input data.
48-byte (384-bit) digest.
Computes the SHA3-512 digest of data.
Input data.
64-byte (512-bit) digest.