modhex

package
v0.0.0-...-b6cf3cc Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLength = errors.New("modhex: odd length string")

ErrLength results from decoding an odd length slice.

Functions

func Decode

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

Decode decodes src into dst using the standard encoding.

func DecodeString

func DecodeString(s string) ([]byte, error)

DecodeString returns the bytes represented by the modhex string s.

func DecodedLen

func DecodedLen(n int) int

DecodedLen returns the length of decoding n bytes.

func Encode

func Encode(dst, src []byte) int

Encode encodes src into dst using the standard encoding.

func EncodeToString

func EncodeToString(src []byte) (str string)

EncodeToString returns the modhex encoding of src.

func EncodedLen

func EncodedLen(n int) int

EncodedLen returns the length of encoding n bytes.

func Translate

func Translate(s string) []string

Translate calls TranslateTo with the standard modhex alphabet.

func TranslateOne

func TranslateOne(s string) (string, error)

TranslateOne calls TranslateOneTo with the standard modhex alphabet.

func TranslateOneTo

func TranslateOneTo(s, to string) (string, error)

TranslateOne expects one translation for a given modhex string.

func TranslateTo

func TranslateTo(s, to string) (t []string)

TranslateTo returns possible interpretations of a modhex string. If otp uses all 16 characters in its alphabet, there will be only one possible interpretation of that encoded string (except for two Armenian keyboard layouts).

Types

type InvalidByteError

type InvalidByteError byte

InvalidByteError values describe errors resulting from an invalid byte in a modhex string.

func (InvalidByteError) Error

func (err InvalidByteError) Error() string

Jump to

Keyboard shortcuts

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