1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-05 00:32:52 +08:00
Go to file
2022-07-07 00:08:32 +08:00
2021-08-08 00:28:17 +08:00
2022-04-22 21:05:19 +08:00
2022-04-22 21:05:19 +08:00
2022-07-07 00:08:32 +08:00
2022-04-22 21:05:19 +08:00
2022-06-11 22:11:59 +08:00
2022-04-22 10:32:20 +08:00
2022-04-22 21:05:19 +08:00
2022-04-22 21:05:19 +08:00
2022-04-22 21:05:19 +08:00
2022-04-22 21:05:19 +08:00
2022-02-10 13:58:39 +08:00
2021-08-08 00:28:17 +08:00
2022-04-22 21:15:46 +08:00
2021-10-28 14:02:36 +08:00

go-base16384

base16384 interface of golang

Usage

Quick start

package main

import (
	"fmt"

	b14 "github.com/fumiama/go-base16384"
)

func main() {
	str := b14.EncodeString("1234567")
	fmt.Println(str, b14.DecodeString(str))
}

API

func Encode(b []byte) (encd []byte)

func EncodeLen(in int) (out int)

func EncodeTo(b, encd []byte) error

func EncodeToString(b []byte) string

func EncodeFromString(s string) []byte

func EncodeString(s string) string

func DecodeLen(in, offset int) (out int)

func Decode(b []byte) (decd []byte)

func DecodeTo(b []byte, decd []byte) error

func DecodeToString(d []byte) string

func DecodeFromString(s string) []byte

func DecodeString(s string) string

Stream API

package main

import (
	"bytes"
	"crypto/rand"
	"io"

	b14 "github.com/fumiama/go-base16384"
)

func main() {
	buf := make([]byte, 1024*1024+1)
	_, err := rand.Read(buf)
	if err != nil {
		panic(err)
	}
	w := bytes.NewBuffer(make([]byte, 0, 1024*1024+1))
	e := b14.NewEncoder(bytes.NewReader(buf))
	_, err = io.Copy(w, e)
	if err != nil {
		panic(err)
	}
	w2 := bytes.NewBuffer(make([]byte, 0, 1024*1024+1))
	d := b14.NewDecoder(bytes.NewReader(w.Bytes()))
	_, err = io.Copy(w2, d)
	if err != nil {
		panic(err)
	}
	if !bytes.Equal(buf, w2.Bytes()) {
		panic("fail!")
	}
}
Description
base16384 interface of golang
Readme GPL-3.0 92 KiB
Languages
Go 53.1%
Assembly 34.3%
C 12.6%