hexutils

package module
v0.0.0-...-f865a37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2016 License: BSD-3-Clause Imports: 3 Imported by: 2

README

hexutils

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.

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

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

func Dump(aStartAddr uint, 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

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 GetByte0FromUInt32(aData uint32) byte

func GetByte1FromUInt32

func GetByte1FromUInt32(aData uint32) byte

func GetByte2FromUInt32

func GetByte2FromUInt32(aData uint32) byte

func GetByte3FromUInt32

func GetByte3FromUInt32(aData uint32) byte

func GetUInt160FromUInt32

func GetUInt160FromUInt32(aData uint32) uint16

func GetUInt161FromUInt32

func GetUInt161FromUInt32(aData uint32) uint16

func GetUInt80FromUInt32

func GetUInt80FromUInt32(aData uint32) uint8

func GetUInt81FromUInt32

func GetUInt81FromUInt32(aData uint32) uint8

func GetUInt82FromUInt32

func GetUInt82FromUInt32(aData uint32) uint8

func GetUInt83FromUInt32

func GetUInt83FromUInt32(aData uint32) uint8

func MakeUInt16BE

func MakeUInt16BE(aBytes [2]byte) uint16

MakeUInt16BE makes uint16 from byte array

func MakeUInt16LE

func MakeUInt16LE(aBytes [2]byte) uint16

MakeUInt16LE makes uint16 from byte array

func MakeUInt32FromByte

func MakeUInt32FromByte(aB3, aB2, aB1, aB0 byte) uint32

func MakeUInt32FromUInt16

func MakeUInt32FromUInt16(aHi, aLo uint16) uint32

MakeUInt32FromUInt16 makes uint32 from two uint16

func MakeUInt32FromUInt8

func MakeUInt32FromUInt8(aB3, aB2, aB1, aB0 uint8) uint32

func ToUInt16

func ToUInt16(aBytes [4]byte) (uint16, error)

ToUInt8 converts hex bytes into uint8. Digits are assumed to be in big endian format within bytes.

func ToUInt8

func ToUInt8(aBytes [2]byte) (uint8, error)

ToUInt8 converts hex digits into uint8. Digits are assumed to be in big endian format.

Types

type Err

type Err string

Err contains information about the failure

func (Err) Error

func (meErr Err) Error() string

Error returns printable string of the failure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL