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.

Syntax
Luau
syn.crypt.custom.decrypt(
    cipher: string,
    data: string,
    key: string,
    iv: string
) -> string

Parameters

Function parameters
ParameterTypeDescription
cipherstringCipher name: aes-cbc, aes-cfb, aes-ctr, aes-ofb, aes-gcm, aes-eax, bf-cbc, bf-cfb, or bf-ofb.
datastringBase64 ciphertext returned by the matching custom encryption operation.
keystringRaw key bytes: 16, 24, or 32 bytes for AES; 4–56 bytes for Blowfish.
ivstringRaw IV or nonce bytes. AES CBC/CFB/CTR/OFB use 16 bytes; Blowfish uses 8 bytes. GCM requires a nonempty nonce.

Returns

string

Plaintext 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

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))
Kawaii documentation