Skip to main content
Encoding, hashing, encryption, and compression.

Available functions

base64_decode

Decodes Base64 input with Base64 decoder and returns the decoded bytes as a Lua string.

base64_encode

Encodes a Lua string’s bytes with Base64 encoder, using = padding and no line breaks.

crypt.decrypt

Decrypts Base64 ciphertext with a Base64-decoded key and required Base64 IV using AES CBC or ECB.

crypt.encrypt

Encrypts Lua string bytes with AES CBC, ECB, or CTR using a Base64-decoded key, then returns Base64 ciphertext and the IV result.

crypt.generatebytes

Generates random bytes with random byte generator and returns them Base64-encoded as a Lua string.

crypt.generatekey

Generates 32 random raw bytes with random byte generator and returns them Base64-encoded as a Lua string.

crypt.hash

Hashes Lua string bytes with a supported crypto library hash algorithm and returns a lowercase hexadecimal digest.

crypt.hmac

Computes a crypto library HMAC over Lua string bytes using a raw Lua string key and returns a Base64 digest.

crypt.random

Generates raw random bytes with random byte generator and returns them as a Lua string.

lz4compress

Compresses Lua string bytes with LZ4 block compression and returns the raw compressed bytes as a Lua string.

lz4decompress

Decompresses raw LZ4 block bytes with LZ4 block decompression and returns raw decompressed bytes as a Lua string.