- Documentation
- Shared functions
- decodeString
Function
decodeString
Decrypts, decodes or unpacks data from encodeString, also data made on another server. With aes128 you pass the key and the iv, with rsa the private key; with zlib the format can be left out: gzip, zlib and raw are recognised by their header. Characters outside the base64 and base32 alphabets are skipped. Works on the server and on the client.
Syntax
string decodeString(string algorithm, string input [, table options, function callback])Arguments
algorithmstring- As in
encodeString. inputstring- The data.
optionstable, optional{ key = "...", iv = "..." },{ variant = "url" },{ format = "gzip" }.callbackfunction, optional- The function gets the result in the next frame.
Returns
The result or false and a warning (e.g. zlib error: -3 for damaged data).
Example
local private, public = generateKeyPair("rsa", { size = 2048 })
local secret = encodeString("rsa", "wiadomosc", { key = public })
outputServerLog(decodeString("rsa", secret, { key = private }))