Symmetric cipher: key, iv, data -> ciphertext (CBC uses PKCS7 padding)
@eryx/crypto/hazmat/_crypto Module
JSON
Type facade for the optional native crypto backend.
This module keeps the typed hazmat crypto surface available to Luau
callers. In builds without cryptography support,
require("@eryx/crypto/hazmat/_crypto") fails immediately with a
clear capability error.
Summary
Classes
ChaCha20Lib.poly1305_encrypt(key: buffer, nonce: buffer, data: buffer, aad: buffer?) → (buffer, buffer)
ChaCha20Lib.poly1305_decrypt(key: buffer, nonce: buffer, ct: buffer, tag: buffer, aad: buffer?) → buffer
API Reference
Classes
HashLib
Properties
HashLib.md5
HashLib.md5(data: buffer) → buffer
HashLib.sha1
HashLib.sha1(data: buffer) → buffer
HashLib.sha224
HashLib.sha224(data: buffer) → buffer
HashLib.sha256
HashLib.sha256(data: buffer) → buffer
HashLib.sha384
HashLib.sha384(data: buffer) → buffer
HashLib.sha512
HashLib.sha512(data: buffer) → buffer
HashLib.sha3_224
HashLib.sha3_224(data: buffer) → buffer
HashLib.sha3_256
HashLib.sha3_256(data: buffer) → buffer
HashLib.sha3_384
HashLib.sha3_384(data: buffer) → buffer
HashLib.sha3_512
HashLib.sha3_512(data: buffer) → buffer
HmacLib
Properties
HmacLib.md5
HmacLib.md5(key: buffer, data: buffer) → buffer
HmacLib.sha1
HmacLib.sha1(key: buffer, data: buffer) → buffer
HmacLib.sha224
HmacLib.sha224(key: buffer, data: buffer) → buffer
HmacLib.sha256
HmacLib.sha256(key: buffer, data: buffer) → buffer
HmacLib.sha384
HmacLib.sha384(key: buffer, data: buffer) → buffer
HmacLib.sha512
HmacLib.sha512(key: buffer, data: buffer) → buffer
HmacLib.sha3_224
HmacLib.sha3_224(key: buffer, data: buffer) → buffer
HmacLib.sha3_256
HmacLib.sha3_256(key: buffer, data: buffer) → buffer
HmacLib.sha3_384
HmacLib.sha3_384(key: buffer, data: buffer) → buffer
HmacLib.sha3_512
HmacLib.sha3_512(key: buffer, data: buffer) → buffer
CipherLib
Properties
CipherLib.ecb_encrypt
CipherLib.ecb_encrypt(key: buffer, data: buffer) → buffer
CipherLib.ecb_decrypt
CipherLib.ecb_decrypt(key: buffer, data: buffer) → buffer
CipherLib.cbc_encrypt
CipherLib.cbc_encrypt(key: buffer, iv: buffer, data: buffer) → buffer
CipherLib.cbc_decrypt
CipherLib.cbc_decrypt(key: buffer, iv: buffer, data: buffer) → buffer
CipherLib.ctr_encrypt
CipherLib.ctr_encrypt(key: buffer, iv: buffer, data: buffer) → buffer
CipherLib.ctr_decrypt
CipherLib.ctr_decrypt(key: buffer, iv: buffer, data: buffer) → buffer
CipherLib.gcm_encrypt
CipherLib.gcm_encrypt(key: buffer, nonce: buffer, data: buffer, aad: buffer?) → (buffer, buffer)
CipherLib.gcm_decrypt
CipherLib.gcm_decrypt(key: buffer, nonce: buffer, ct: buffer, tag: buffer, aad: buffer?) → buffer
CipherLib.ccm_encrypt
CipherLib.ccm_encrypt(key: buffer, nonce: buffer, data: buffer, aad: buffer?) → (buffer, buffer)
CipherLib.ccm_decrypt
CipherLib.ccm_decrypt(key: buffer, nonce: buffer, ct: buffer, tag: buffer, aad: buffer?) → buffer
CamelliaLib
Properties
CamelliaLib.cbc_encrypt
CamelliaLib.cbc_encrypt(key: buffer, iv: buffer, data: buffer) → buffer
CamelliaLib.cbc_decrypt
CamelliaLib.cbc_decrypt(key: buffer, iv: buffer, data: buffer) → buffer
CamelliaLib.ctr_encrypt
CamelliaLib.ctr_encrypt(key: buffer, iv: buffer, data: buffer) → buffer
CamelliaLib.ctr_decrypt
CamelliaLib.ctr_decrypt(key: buffer, iv: buffer, data: buffer) → buffer
CamelliaLib.gcm_encrypt
CamelliaLib.gcm_encrypt(key: buffer, nonce: buffer, data: buffer, aad: buffer?) → (buffer, buffer)
CamelliaLib.gcm_decrypt
CamelliaLib.gcm_decrypt(key: buffer, nonce: buffer, ct: buffer, tag: buffer, aad: buffer?) → buffer
DesLib
3DES only; key must be 24 bytes
Properties
DesLib.cbc_encrypt
DesLib.cbc_encrypt(key: buffer, iv: buffer, data: buffer) → buffer
DesLib.cbc_decrypt
DesLib.cbc_decrypt(key: buffer, iv: buffer, data: buffer) → buffer
ChaCha20Lib
Properties
ChaCha20Lib.encrypt
ChaCha20Lib.encrypt(key: buffer, nonce: buffer, data: buffer) → buffer
ChaCha20Lib.decrypt
ChaCha20Lib.decrypt(key: buffer, nonce: buffer, data: buffer) → buffer
ChaCha20Lib.poly1305_encrypt
ChaCha20Lib.poly1305_encrypt(key: buffer, nonce: buffer, data: buffer, aad: buffer?) → (buffer, buffer)
ChaCha20Lib.poly1305_decrypt
ChaCha20Lib.poly1305_decrypt(key: buffer, nonce: buffer, ct: buffer, tag: buffer, aad: buffer?) → buffer