Cryptography

base64_decode

Decodes Base64 input with Base64 decoder and returns the decoded bytes as a Lua string.

Syntax

base64_decode(data: string): string
Aliases base64decodebase64.decodecrypt.base64.decodecrypt.base64_decodecrypt.base64decode

Arguments

NameTypeDescription
datastringBase64 input passed to Base64 decoder.

Returns

NameTypeDescription
decodedstringDecoded bytes returned as a Lua string with explicit length.

Description

Decodes Base64 input with Base64 decoder and returns the decoded bytes as a Lua string.

Call it with 1 parameter(s): data. The argument table explains which values are required and which ones only refine the behavior.

It returns decoded (string). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Decode Base64 data and read the returned Lua string.

local encoded = base64_encode("hello world")
local decoded = base64_decode(encoded)

print(decoded)
print(base64decode(encoded))
print(base64.decode(encoded))