Cryptography
Encryption, hashes, authentication codes and random bytes.
These functions return different kinds of strings:
| Call | Result |
|---|---|
crypt.random | Raw bytes |
crypt.hash | Hex text |
crypt.hmac | Base64 text |
Encryption:
crypt.encryptandcrypt.decryptuse AES-256-CBC with PKCS#7 padding. CBC does not provide an authentication tag. Check the key and IV encoding on each function page before combining these calls.
Functions
| Function | Purpose |
|---|---|
| crypt.generatekey | Generates 32 random bytes and returns them in Base64. |
| crypt.encrypt | Encrypts bytes using AES-256-CBC with PKCS#7 padding. |
| crypt.decrypt | Decrypts Base64 AES-256-CBC ciphertext. |
| crypt.hash | Computes a hash and returns lowercase hexadecimal text. |
| crypt.hmac | Computes an HMAC and returns its digest in Base64. |
| crypt.random | Generates random bytes as a raw string. |
| crypt.generatebytes | Generates random bytes and encodes them in Base64. |
