Documentation ¶
Overview ¶
hexutils is a simple utility library for golang built on top of in-built "encoding/hex". It provides utility functions to decode hex digits into commonly used integer formats.
Index ¶
- Constants
- func Dump(aStartAddr uint, data []byte) string
- func Dumper(w io.Writer, aStartAddr uint) io.WriteCloser
- func GetByte0FromUInt32(aData uint32) byte
- func GetByte1FromUInt32(aData uint32) byte
- func GetByte2FromUInt32(aData uint32) byte
- func GetByte3FromUInt32(aData uint32) byte
- func GetUInt160FromUInt32(aData uint32) uint16
- func GetUInt161FromUInt32(aData uint32) uint16
- func GetUInt80FromUInt32(aData uint32) uint8
- func GetUInt81FromUInt32(aData uint32) uint8
- func GetUInt82FromUInt32(aData uint32) uint8
- func GetUInt83FromUInt32(aData uint32) uint8
- func MakeUInt16BE(aBytes [2]byte) uint16
- func MakeUInt16LE(aBytes [2]byte) uint16
- func MakeUInt32FromByte(aB3, aB2, aB1, aB0 byte) uint32
- func MakeUInt32FromUInt16(aHi, aLo uint16) uint32
- func MakeUInt32FromUInt8(aB3, aB2, aB1, aB0 uint8) uint32
- func ToUInt16(aBytes [4]byte) (uint16, error)
- func ToUInt8(aBytes [2]byte) (uint8, error)
- type Err
Constants ¶
View Source
const ( //ErrNotHex is error when the hex digit array contains non-hex digit ErrNotHex = Err("Encountered non-hex digit!") )
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
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 ¶
func Dumper(w io.Writer, aStartAddr uint) 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 GetByte0FromUInt32 ¶
func GetByte1FromUInt32 ¶
func GetByte2FromUInt32 ¶
func GetByte3FromUInt32 ¶
func GetUInt160FromUInt32 ¶
func GetUInt161FromUInt32 ¶
func GetUInt80FromUInt32 ¶
func GetUInt81FromUInt32 ¶
func GetUInt82FromUInt32 ¶
func GetUInt83FromUInt32 ¶
func MakeUInt16BE ¶
MakeUInt16BE makes uint16 from byte array
func MakeUInt16LE ¶
MakeUInt16LE makes uint16 from byte array
func MakeUInt32FromByte ¶
func MakeUInt32FromUInt16 ¶
MakeUInt32FromUInt16 makes uint32 from two uint16
func MakeUInt32FromUInt8 ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.