base32

package
v3.0.0-...-305da2a Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package base32 implements the conversion for bytes (base256) to base32.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidLength reports an attempt to decode an input of invalid length.
	ErrInvalidLength = errors.New("invalid length")
	// ErrNonZeroPadding reports an attempt to decode an input without zero padding.
	ErrNonZeroPadding = errors.New("non-zero padding")
)

Functions

func Decode

func Decode(dst []byte, src []uint8) (int, error)

Decode decodes src into DecodedLen(len(src)) bytes, returning the actual number of bytes written to dst. If the input is malformed, Decode returns an error and the number of bytes decoded before the error.

func DecodedLen

func DecodedLen(n int) int

DecodedLen returns the maximum length in bytes of the decoded data corresponding to n base32-encoded values.

func Encode

func Encode(dst []uint8, src []byte) int

Encode encodes src into EncodedLen(len(src)) digits of dst. As a convenience, it returns the number of digits written to dst, but this value is always EncodedLen(len(src)). Encode implements base32 encoding.

func EncodedLen

func EncodedLen(n int) int

EncodedLen returns the length of the base32 encoding of an input buffer of length n.

Types

type CorruptInputError

type CorruptInputError struct {
	Offset int // error occurred after reading Offset bytes
	// contains filtered or unexported fields
}

A CorruptInputError is a description of a base32 syntax error.

func (CorruptInputError) Error

func (e CorruptInputError) Error() string

func (CorruptInputError) Unwrap

func (e CorruptInputError) Unwrap() error

Jump to

Keyboard shortcuts

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