Crypt

Encrypt and decrypt data, produce hashes and HMACs, and source cryptographically secure randomness directly from your scripts.

Overview

Encryption, hashing, HMACs and secure random numbers, plus Base64 and LZ4 in the same namespace.

Encrypt, hash, random
local key = crypt.generatekey()

local secret = crypt.encrypt("webhook url goes here", key)
writefile("config/hook.enc", secret)
print(crypt.decrypt(readfile("config/hook.enc"), key))

-- Comparing without storing the original.
print(crypt.hash("password"))
print(crypt.hmac("message", key))

-- Randomness you can rely on.
print(crypt.random(16))

Keeping the key next to the file doesn't do much

Encrypting a file stops someone casually opening it, not someone who has your whole workspace folder. Keep that in mind.

Encryption

Hashing

Random

Encoding & compression