B62 is a Go package for encoding and decoding data using Base62 encoding. Base62 encoding is a method of representing binary data in an ASCII string format using 62 characters (A-Z, a-z, 0-9). This package provides functions to encode and decode data efficiently.
- Encode binary data to Base62 string
- Decode Base62 string back to binary data
- Handles edge cases and invalid characters gracefully
To install the package, use the following command:
go get github.com/inovacc/base62
package main
import (
"fmt"
"github.com/inovacc/base62"
)
func main() {
data := []byte("Hello, World!")
encoded := base62.Encode(data)
fmt.Println("Encoded:", encoded)
}
package main
import (
"fmt"
"github.com/inovacc/base62"
)
func main() {
encoded := "Base62EncodedString"
decoded, err := base62.Decode(encoded)
if err != nil {
fmt.Println("Error decoding:", err)
return
}
fmt.Println("Decoded:", string(decoded))
}