Documentation
ยถ
Overview ยถ
Package base100 provides a Go implementation of Base๐ฏ.
For the original Rust version see https://github.com/AdamNiederer/base100.
Index ยถ
Examples ยถ
Constants ยถ
This section is empty.
Variables ยถ
This section is empty.
Functions ยถ
func Decode ยถ
Decode decodes src using base100. It writes at most DecodedLen(len(src)) bytes to dst and returns the number of bytes written.
New line characters (\r and \n) should be stripped beforehand.
Example ยถ
src := []byte("๐ซ๐๐๐๐จ๐ฌ๐ ๐๐ข๐๐๐ฉ๐ฆ๐ฎ๐ฅ๐๐๐ฆ๐ฏ๐๐ก๐ฌ๐ค๐ง๐๐๐๐ฆ๐ญ๐๐ฉ๐๐ซ๐๐๐๐ฃ๐๐ฑ๐ฐ๐๐๐ฆ๐๐")
dst := make([]byte, base100.DecodedLen(len(src)))
_, err := base100.Decode(dst, src)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s", dst)
Output: the quick brown fox jumped over the lazy dog
func DecodeString ยถ
DecodeString returns the bytes represented by the base100 string s.
Example ยถ
src := "๐ซ๐๐๐๐จ๐ฌ๐ ๐๐ข๐๐๐ฉ๐ฆ๐ฎ๐ฅ๐๐๐ฆ๐ฏ๐๐ก๐ฌ๐ค๐ง๐๐๐๐ฆ๐ญ๐๐ฉ๐๐ซ๐๐๐๐ฃ๐๐ฑ๐ฐ๐๐๐ฆ๐๐"
result, _ := base100.DecodeString(src)
fmt.Printf("%s", result)
Output: the quick brown fox jumped over the lazy dog
func DecodedLen ยถ
DecodedLen returns the maximum length in bytes of the decoded data corresponding to n bytes of base100-encoded data.
func Encode ยถ
func Encode(dst, src []byte)
Encode encodes src to its base100 encoding, writing EncodedLen(len(src)) bytes to dst.
Example ยถ
src := []byte("the quick brown fox jumped over the lazy dog\n")
dst := make([]byte, base100.EncodedLen(len(src)))
base100.Encode(dst, src)
fmt.Printf("%s", dst)
Output: ๐ซ๐๐๐๐จ๐ฌ๐ ๐๐ข๐๐๐ฉ๐ฆ๐ฎ๐ฅ๐๐๐ฆ๐ฏ๐๐ก๐ฌ๐ค๐ง๐๐๐๐ฆ๐ญ๐๐ฉ๐๐ซ๐๐๐๐ฃ๐๐ฑ๐ฐ๐๐๐ฆ๐๐
func EncodeToString ยถ
EncodeToString returns the base100 encoding of src.
Example ยถ
src := []byte("the quick brown fox jumped over the lazy dog\n")
fmt.Println(base100.EncodeToString(src))
Output: ๐ซ๐๐๐๐จ๐ฌ๐ ๐๐ข๐๐๐ฉ๐ฆ๐ฎ๐ฅ๐๐๐ฆ๐ฏ๐๐ก๐ฌ๐ค๐ง๐๐๐๐ฆ๐ญ๐๐ฉ๐๐ซ๐๐๐๐ฃ๐๐ฑ๐ฐ๐๐๐ฆ๐๐
func EncodedLen ยถ
EncodedLen returns the length in bytes of the base100 encoding of an input buffer of length n.
func NewDecoder ยถ
NewDecoder constructs a new base100 stream decoder.
Types ยถ
This section is empty.