Access
All crypto C++ functions are exposed to your Lua script via a single global table namedcrypto. You access individual values by using the dot (.) or bracket ([]) operator on this table.
Crypto Usage Example
Functions
This section lists all available C++ functions exposed within the globalcrypto table. These functions provide utilities for hashing, encoding/decoding data (like Base64 and Hex), and generating cryptographic primitives.
base64_encode
Encodes a string to Base64 format. Returns the Base64-encoded string.base64_decode
Decodes a Base64-encoded string back to its original format. Returns the decoded string, or"Unknown" if decoding fails.
hex_encode
Encodes a string to hexadecimal format. Returns the hexadecimal-encoded string.hex_decode
Decodes a hexadecimal-encoded string back to its original format. Returns the decoded string, or"Unknown" if decoding fails.
hash_sha256
Computes the SHA-256 hash of a string. Returns the hash as a string.hash_sha512
Computes the SHA-512 hash of a string. Returns the hash as a string.hash_blake2b
Computes the BLAKE2b hash of a string with a specified output size. Returns the hash as a string, or"Invalid size" if the size exceeds the maximum, or "Unknown" if hashing fails.
The desired output size of the hash in bytes. Must not exceed the maximum allowed size.