base256

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CHARSET = []rune("!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^`abcdefghijklmnopqrstuvwxyz{|}€¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷ùúûüýÿăąĊčđĕĘğħĩĭıĵķĿŀŁłňŋŏœŖřŝşŦŧũūůŲŵſƀƁƂƄƆƇƔƕƗƙƛƜƟƢƥƦƧƩƪƭƮưƱƲƵƸƺƾǀǁǂƿǬǮǵǶǹǻǿ")

Based on the 512-characters UTF-8 table - @see https://www.utf8-chartable.de/unicode-utf8-table.pl?number=512

Functions

func CharAt

func CharAt(index int) string

CharAt returns the character string at the passed index in the Base-256 character set

func IndexOf

func IndexOf(char rune) int

IndexOf ...

Types

type Readable

type Readable string

Readable represents a character in a readable base-256 charset

func HexToReadable

func HexToReadable(hex string) (b256 Readable, err error)

HexToReadable ...

func NumberToReadable added in v1.4.1

func NumberToReadable(n uint64) (b256 Readable, err error)

NumberToReadable ...

func ToBase256Readable

func ToBase256Readable(barray []byte) Readable

ToBase256Readable ...

func (Readable) Bytes

func (b256 Readable) Bytes() []byte

Bytes ...

func (Readable) IsEmpty

func (b256 Readable) IsEmpty() bool

IsEmpty ...

func (Readable) Len

func (b256 Readable) Len() int

Len ...

func (Readable) NonEmpty

func (b256 Readable) NonEmpty() bool

NonEmpty ...

func (Readable) String

func (b256 Readable) String(useAscii ...bool) string

String ...

NB: By passing `true` as argument, you signify you don't want to use the readable charset but force the ASCII rendering, implying that you'd probably get unreadable characters if the underlying byte array uses byte that ranges over 127 but that you'd get the correct length when using the len() function on the resulting string

func (Readable) ToHex

func (b256 Readable) ToHex() string

ToHex ...

func (Readable) ToNumber added in v1.4.1

func (b256 Readable) ToNumber(nbZeroPad ...int) string

ToNumber returns the stringified value of the underlying integer

You may pass a minimum size for the returned number to add padding zeroes accordingly

func (Readable) Uint64 added in v1.4.1

func (b256 Readable) Uint64() uint64

Uint64 ...

Jump to

Keyboard shortcuts

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