Package hex implements hexadecimal encoding and decoding.

Static methods

staticinlinedecode(_dst:Slice<GoUInt8>, _src:Slice<GoUInt8>):{_1:Error, _0:GoInt}

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

Decode expects that src contains only hexadecimal characters and that src has even length. If the input is malformed, Decode returns the number of bytes decoded before the error.

See also:

staticinlinedecodeString(_s:GoString):{_1:Error, _0:Slice<GoUInt8>}

DecodeString returns the bytes represented by the hexadecimal string s.

DecodeString expects that src contains only hexadecimal characters and that src has even length. If the input is malformed, DecodeString returns the bytes decoded before the error.

See also:

staticinlinedecodedLen(_x:GoInt):GoInt

DecodedLen returns the length of a decoding of x source bytes. Specifically, it returns x / 2.

See also:

staticinlinedump(_data:Slice<GoUInt8>):GoString

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.

See also:

staticinlinedumper(_w:Writer):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.

See also:

staticinlineencode(_dst:Slice<GoUInt8>, _src:Slice<GoUInt8>):GoInt

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.

See also:

staticinlineencodeToString(_src:Slice<GoUInt8>):GoString

EncodeToString returns the hexadecimal encoding of src.

See also:

staticinlineencodedLen(_n:GoInt):GoInt

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

See also:

staticinlinenewDecoder(_r:Reader):Reader

NewDecoder returns an io.Reader that decodes hexadecimal characters from r. NewDecoder expects that r contain only an even number of hexadecimal characters.

See also:

staticinlinenewEncoder(_w:Writer):Writer

NewEncoder returns an io.Writer that writes lowercase hexadecimal characters to w.

See also: