Skip to content

Crypt

Encrypt

<string> syn.crypt.encrypt(<string> data, <string> key)  

Encrypt's data with key.

Decrypt

<string> syn.crypt.decrypt(<string> data, <string> key)  

Decrypt's data with key.

Base64 Encode

<string> syn.crypt.base64.encode(<string> data)  

Encodes data with base64.

Base64 Decode

<string> syn.crypt.base64.decode(<string> data)  

Decodes data with base64.

Hash

<string> syn.crypt.hash(<string> data)

Hashes data.

Derive

<string> syn.crypt.derive(<string> value, <number> len)

Derives a secret key from value with the length of len.

Random

<string> syn.crypt.random(<number> size)

Generates a random string with size (cannot be neagtive or exceed 1024).

Custom


Encrypt

<string> syn.crypt.custom.encrypt(<string> cipher, <string> data, <string> key, <string> iv)

Encrypt's data with key using selected cipher and iv(initialization vector).

Decrypt

<string> syn.crypt.custom.decrypt(<string> cipher, <string> data, <string> key, <string> iv)

Decrypt's data with key using selected cypher and iv(initialization vector).

Hash

<string> syn.crypt.custom.hash(<string> algorithm, <string> data)

Hashes data with algorithm.

Encryption/Decryption ciphers

You can use both - and _. With Blowfish bf or blowfish.

AES Blowfish
aes-cbc bf-cbc
aes-cfb bf-cfb
aes-ctr bf-ofb
aes-ofb
aes-gcm
aes-eax

Hashing algorithms

Same goes here, you can use - or _.

MD5 SHA1 SHA2 SHA3
md5 sha1 sha224 sha3-256
sha256 sha3-384
sha384 sha3-512
sha512

Example

local enc = syn.crypt.custom.encrypt(
    "aes-gcm",
    "hi gamers!", 
    "$nLliCMdi7gcynsFCK9u0aVNdtkNIiZG",
    "Agd13KuKIL2$")

print(enc)

print(syn.crypt.custom.decrypt(
    "aes-gcm",
    enc,
    "$nLliCMdi7gcynsFCK9u0aVNdtkNIiZG",
    "Agd13KuKIL2$")) --"hi gamers"