An encoder and decoder implementation in Go for Azam Codec, a lexicographically sortable multi-section base16 encoding of byte array. Zero external dependencies.
MIT Licence Copyright (c) 2024 Azamshul Azizy
Import the crate and start using it.
import {
"github.com/azam/azamcodec"
}
// Decode Azam-encoded string as slice of `uint`'s` (`[]uint`).
nums, err := azamcodec.Decode("xytxvyyfh5wgg1"); // nums = []uint {0xdeadbeef, 0x15, 0xc001}import {
"github.com/azam/azamcodec"
}
// Encode uint value as Azam-encoded string.
// 0xdeadbeefu32 encodes to "xytxvyyf".
str = azamcodec.EncodeUint(0xdeadbeef) // "xytxvyyf"
// Encode multiple `uint` values as Azam-encoded string.
// 0xdeadbeefu32 encodes to "xytxvyyf".
// 0x15u8 encodes to "h5".
// 0xc001u16 encodes to "wgg1".
// Resulting encoded string appends in order.
str = azamcodec.EncodeUints(0xdeadbeef, 0x15, 0xc001) // "xytxvyyfh5wgg1"Standard Go development applies. Benchmark is also included, executable via go test -bench.