package
0.7.0
Repository: https://github.com/vadv/gopher-lua-libs.git
Documentation: pkg.go.dev

# README

hex GoDoc

Lua module for encoding/hex

Usage

Encoding

local hex = require("hex")

s = hex.RawStdEncoding:encode_to_string("foo\01bar")
print(s)
Zm9vAWJhcg

s = hex.StdEncoding:encode_to_string("foo\01bar")
print(s)
Zm9vAWJhcg==

s = hex.RawURLEncoding:encode_to_string("this is a <tag> and should be encoded")
print(s)
dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA

s = hex.URLEncoding:encode_to_string("this is a <tag> and should be encoded")
print(s)
dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA==

Decoding

local hex = require 'hex'

decoded, err = hex.decode_string("666f6f62617262617a")
assert(not err, err)
print(decoded)
foobar

encoded = hex.encode_to_string(decoded)
print(encoded)
666f6f62617262617a