Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 1.91 KB

README.md

File metadata and controls

54 lines (42 loc) · 1.91 KB

base91-go

Travis Go Report Card Release License GoDoc

basE91 codec implemented in Golang.

Migrated from the C and PHP version of Joachim Henke's basE91.

Nodejs version

Install

$ go get -u ekyu.moe/base91

Example

package main

import (
    "fmt"

    "ekyu.moe/base91"
)

func main() {
    fmt.Println(base91.EncodeToString([]byte("Hello, 世界"))) //=> >OwJh>}AFU~PUh%Y
    fmt.Println(string(base91.DecodeString(">OwJh>}AFU~PUh%Y"))) //=> Hello, 世界
}

Check godoc for further documents.

A CLI utility is also available with go get ekyu.moe/base91/cmd/base91.

Benchmark

Note: 1 op = 1 MB input

$ go test --bench . --benchmem ekyu.moe/base91
goos: windows
goarch: amd64
pkg: ekyu.moe/base91
BenchmarkDecode-4            200           6484956 ns/op         7157760 B/op         36 allocs/op
BenchmarkDecoder-4           200           8789155 ns/op         146.71 MB/s     2136691 B/op      2465 allocs/op
BenchmarkEncode-4            300           7264316 ns/op         8673280 B/op         37 allocs/op
BenchmarkEncoder-4           200           7149004 ns/op         146.67 MB/s     2808690 B/op         2 allocs/op
PASS

License

BSD-3-clause