Encoder and decoder implementation of base122 encoding scheme in Go programing language.
Base122 is a space efficient binary-to-text encoding scheme, which encodes the binary into UTF-8 strings. It use less space to encode your binary data compared to base64 (12.5% higher efficiency according to this wiki page).
This repo is inspired by patrickfav/base122-java and kevinAlbs/Base122, and aims to provide easy-to-use interface for Gophers to use base122 to improve your encoding efficiency.
Go >= 1.18
go get github.com/vence722/base122-go
Simple encode & decode example:
import "github.com/vence722/base122-go"
...
// Encode
s := "hello base122!!!"
encText, err := base122.EncodeToString([]byte(s))
if err != nil {
// error handling
}
fmt.Println(encText) // 4�-Fc<@b0S Hd!�H
...
// Decode
txt, err := base122.DecodeFromString(encText)
if err != nil {
// error handling
}
fmt.Println(txt == s) // true
Vence Lin (vence722@gmail.com)