Sample code for 30+ languages & platforms
Lua Requires Chilkat v11.2.0+

Base62 Encoding and Decoding

Demonstrates base62 encoding and decoding.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local bd = chilkat.BinData.new()

-- Base62 encode.
bd:append_string("hello world", "utf-8")
local base62_encoded = bd:get_encoded("base62")
print("hello world --> " .. base62_encoded)

-- Output:
-- hello world --> AAwf93rvy4aWQVw

-- Base62 decode
local sb = chilkat.StringBuilder.new()
sb:decode_and_append("AAwf93rvy4aWQVw", "base62", "utf-8")
print("decoded: " .. sb:get_as_string())

-- Output:
-- decoded: hello world