Documentation ¶
Index ¶
- type Encoding
- func (enc *Encoding) Base() int
- func (enc *Encoding) DecodeString(s string) ([]byte, error)
- func (enc *Encoding) DecodeStringN(s string, n int) ([]byte, error)
- func (enc *Encoding) EncodeToString(b []byte) string
- func (enc *Encoding) MustRandom(n int) string
- func (enc *Encoding) Random(n int) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
Encoding represents a given common-N encoding.
func NewEncoding ¶
NewEncoding creates a new common-N representation from the given alphabet. Panics if the alphabet is not unique. Only ASCII characters are supported.
func (*Encoding) DecodeString ¶
DecodeString returns the bytes for the given common-encoded string.
func (*Encoding) DecodeStringN ¶
DecodeStringN returns N bytes for the given common-encoded string. Use this method to ensure the value is left-padded with zeroes.
func (*Encoding) EncodeToString ¶
EncodeToString returns the common-encoded string representation of the given bytes.
func (*Encoding) MustRandom ¶
MustRandom returns the common-encoded representation of n random bytes, panicking in the unlikely event of a read error from the random source.
Click to show internal directories.
Click to hide internal directories.