Package hex

Package hex implements hexadecimal encoding and decoding functions.

Constants

This section is empty.

Variables

var Digits = []byte{48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102}

Digits define the hexadecimal ASCII digits (0-9, a-f).

Functions

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

DecodeString decodes the bytes represented by the hexadecimal string s. The function returns also a boolean success value. The success value is false if the input string length is not even or if any of the runes in the input string are not valid hexadecimal digits (0-9, a-f, A-F).

func DigitToByte
func DigitToByte(r rune) int32

DigitToByte converts the hexadecimal digit r to its byte value. The return value is math.MaxInt32 if the input digit is invalid.

func EncodeToString
func EncodeToString(src []byte) string

EncodeToString returns a hexadecimal encoding of src.

func EncodedLen
func EncodedLen(n int) int

EncodedLen returns the length of an encoding of n source bytes. Specifically, this returns n * 2.

Types

This section is empty.