Documentation ¶
Index ¶
- func Fingerprint(slice []byte) []byte
- type HexBytes
- func (bz HexBytes) Bytes() []byte
- func (bz HexBytes) Format(s fmt.State, verb rune)
- func (bz HexBytes) Marshal() ([]byte, error)
- func (bz HexBytes) MarshalText() ([]byte, error)
- func (bz HexBytes) String() string
- func (bz *HexBytes) Unmarshal(data []byte) error
- func (bz *HexBytes) UnmarshalText(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
Fingerprint returns the first 6 bytes of a byte slice. If the slice is less than 6 bytes, the fingerprint contains trailing zeroes.
Types ¶
type HexBytes ¶
type HexBytes []byte
HexBytes is a wrapper around []byte that encodes data as hexadecimal strings for use in JSON.
func (HexBytes) Format ¶
Format writes either address of 0th element in a slice in base 16 notation, with leading 0x (%p), or casts HexBytes to bytes and writes as hexadecimal string to s.
func (HexBytes) MarshalText ¶
MarshalText encodes a HexBytes value as hexadecimal digits. This method is used by json.Marshal.
func (*HexBytes) UnmarshalText ¶
UnmarshalText handles decoding of HexBytes from JSON strings. This method is used by json.Unmarshal. It allows decoding of both hex and base64-encoded byte arrays.