-
Notifications
You must be signed in to change notification settings - Fork 0
/
base85.go
43 lines (29 loc) · 983 Bytes
/
base85.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Go Lang Base85
// (c) 2021-2023 unix-world.org
// License: BSD
// v.20231129.2358
package base85
import (
bconv "github.com/unix-world/smartgo/baseconv"
)
const name string = "Base85"
const radix int64 = 85
const encodeStd string = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#" // base85 charset
//--
var bConv bconv.BaseConv = bconv.NewBaseConv(name, radix, encodeStd)
//--
// Encode takes a slice of bytes and encodes it to baseXY string. Leading zero bytes are kept in place for precise decoding.
func Encode(input []byte) (output string) {
//--
return bConv.Encode(input) // output
//--
} //END FUNCTION
//--
// Decode takes string as an input and returns decoded string and error. If provided string contains characters illegal for baseXY the returned error will be <notnil>
func Decode(input string) (output []byte, err error) {
//--
return bConv.Decode(input) // output, err
//--
} //END FUNCTION
//--
// #END