syn. crypt. custom. decrypt Synchronous
syn.crypto.custom.decrypt
Decrypt Base64 ciphertext using an explicitly selected cipher and raw key material. Use it to reverse the matching custom encryption call. This interface expects raw key and IV bytes, unlike the Base64 key and IV arguments of crypt.decrypt.
Luau
syn.crypt.custom.decrypt(
cipher: string,
data: string,
key: string,
iv: string
) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
cipher | string | Cipher name: aes-cbc, aes-cfb, aes-ctr, aes-ofb, aes-gcm, aes-eax, bf-cbc, bf-cfb, or bf-ofb. |
data | string | Base64 ciphertext returned by the matching custom encryption operation. |
key | string | Raw key bytes: 16, 24, or 32 bytes for AES; 4–56 bytes for Blowfish. |
iv | string | Raw IV or nonce bytes. AES CBC/CFB/CTR/OFB use 16 bytes; Blowfish uses 8 bytes. GCM requires a nonempty nonce. |
Returns
stringPlaintext bytes.
Usage notes
Use the same cipher, key, and IV used for encryption.
Availability
This function requires the Synapse environment setting, which is off by default.
Example
Luau
-- Enable the Synapse environment setting first.
local key = syn.crypt.random(32)
local nonce = syn.crypt.random(12)
local ciphertext = syn.crypt.custom.encrypt("aes-gcm", "example note", key, nonce)
print(syn.crypt.custom.decrypt("aes-gcm", ciphertext, key, nonce))