Go: encoding/hex Index | Files

package hex

import "encoding/hex"

Package hex implements hexadecimal encoding and decoding.

Index

Package Files

hex.go

Variables

var ErrLength = errors.New("encoding/hex: odd length hex string")

ErrLength results from decoding an odd length slice.

func Decode Uses

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

Decode decodes src into DecodedLen(len(src)) bytes, returning the actual number of bytes written to dst.

If Decode encounters invalid input, it returns an error describing the failure.

func DecodeString Uses

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

DecodeString returns the bytes represented by the hexadecimal string s.

func DecodedLen Uses

func DecodedLen(x int) int

func Dump Uses

func Dump(data []byte) string

Dump returns a string that contains a hex dump of the given data. The format of the hex dump matches the output of `hexdump -C` on the command line.

func Dumper Uses

func Dumper(w io.Writer) io.WriteCloser

Dumper returns a WriteCloser that writes a hex dump of all written data to w. The format of the dump matches the output of `hexdump -C` on the command line.

func Encode Uses

func Encode(dst, src []byte) int

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

func EncodeToString Uses

func EncodeToString(src []byte) string

EncodeToString returns the hexadecimal encoding of src.

func EncodedLen Uses

func EncodedLen(n int) int

EncodedLen returns the length of an encoding of n source bytes.

type InvalidByteError Uses

type InvalidByteError byte

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

func (InvalidByteError) Error Uses

func (e InvalidByteError) Error() string

Package hex imports 4 packages (graph) and is imported by 7243 packages. Updated 2016-12-02. Refresh now. Tools for package owners.