base91

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2017 License: BSD-3-Clause Imports: 2 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

base91-go

Travis Go Report Card license GoDoc

basE91 codec implemented in Golang.

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

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.

Benchmark

Note: 1 op = 1 MB input

$ go test -bench . -benchmem ekyu.moe/base91
goos: windows
goarch: amd64
pkg: ekyu.moe/base91
BenchmarkDecode-4             20          65212520 ns/op         7157760 B/op         36 allocs/op
BenchmarkDecoder-4            20          88480005 ns/op         8000756 B/op         38 allocs/op
BenchmarkEncode-4            200           7172590 ns/op         8673288 B/op         37 allocs/op
BenchmarkEncoder-4           200           8590670 ns/op         2324512 B/op         24 allocs/op
PASS
ok      ekyu.moe/base91 8.572s

License

BSD-3.0

Documentation

Overview

Package base91 implements a base91 encoder and decoder.

base91 is defined in Joachim Henke's basE91: http://base91.sourceforge.net/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(dst, src []byte) int

Decode decodes src into dst. It returns the number of bytes written to dst.

func DecodeString

func DecodeString(s string) []byte

DecodeString returns the bytes represented by the base91 string s, probably what you want.

func Encode

func Encode(dst, src []byte) int

Encode encodes src into dst. It returns the number of bytes written to dst. Whereas base91 uses up to nearly all printable characters, Encode skips invalid characters silently.

func EncodeToString

func EncodeToString(src []byte) string

EncodeToString returns the encoded base91 string of src, probably what you want.

func NewDecoder

func NewDecoder(r io.Reader) io.Reader

NewDecoder constructs a new base91 stream decoder. Data read from the returned reader is base91 decoded from r.

func NewEncoder

func NewEncoder(w io.Writer) io.WriteCloser

NewEncoder returns a new base91 stream encoder. Data written to the returned writer will be encoded using base91 and then written to w. When finished writing, the caller must Close the returned encoder to flush any partially written blocks.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL