git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/base32/base32.go (about) 1 package base32 2 3 import "encoding/base32" 4 5 const ( 6 Alphabet = "0123456789abcdefghjkmnpqrtuvwxyz" 7 ) 8 9 var encoder = base32.NewEncoding(Alphabet).WithPadding(base32.NoPadding) 10 11 func EncodeToString(data []byte) string { 12 return encoder.EncodeToString(data) 13 } 14 15 func DecodeString(input string) ([]byte, error) { 16 return encoder.DecodeString(input) 17 } 18 19 func Decode(dst, src []byte) (n int, err error) { 20 return encoder.Decode(dst, src) 21 }