encoding.ascii85 #
ascii85
ascii85 encodes and decodes binary data using ASCII85 (Base85), as used by Go's encoding/ascii85 and Python's base64.a85encode.
encode produces raw ASCII85 without delimiters or whitespace. A complete group of four zero bytes is written as z; partial groups use two to four characters.
decode ignores ASCII spaces, tabs, line feeds, carriage returns, form feeds, and vertical tabs. It rejects invalid characters, a z inside a group, trailing groups of only one character, and groups whose value exceeds 2^32 - 1, including padded partial groups. Adobe <~ / ~> delimiters and the y space shortcut are not supported.
import encoding.ascii85
enc := ascii85.encode('Hello, World!'.bytes())
assert ascii85.decode(enc)! == 'Hello, World!'.bytes()
fn decode #
fn decode(s string) ![]u8
decode returns the bytes represented by the ASCII85 string s. ASCII whitespace is ignored. 'z' expands to four zero bytes. Invalid characters, misplaced 'z', one-character trailing groups, and groups that overflow 32 bits are errors. Adobe delimiters are not accepted.
fn encode #
fn encode(data []u8) string
encode returns the ASCII85 encoding of data. The output contains no delimiters and no whitespace.