Documentation ¶
Index ¶
- func Bytes2Hex(d []byte) string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func FromHex(s string) []byte
- func Has0xPrefix(str string) bool
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func IsHex(str string) bool
- func IsHexCharacter(c byte) bool
- func LeftPadBytes(slice []byte, l int) []byte
- func ParseHexOrString(str string) ([]byte, error)
- func RightPadBytes(slice []byte, l int) []byte
- func TrimLeftZeroes(s []byte) []byte
- func TrimRightZeroes(s []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Has0xPrefix ¶
has0xPrefix validates str begins with '0x' or '0X'.
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func IsHexCharacter ¶
isHexCharacter returns bool of c being a valid hexadecimal.
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func ParseHexOrString ¶
ParseHexOrString tries to hexdecode b, but if the prefix is missing, it instead just returns the raw bytes
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func TrimLeftZeroes ¶
TrimLeftZeroes returns a subslice of s without leading zeroes
func TrimRightZeroes ¶
TrimRightZeroes returns a subslice of s without trailing zeroes
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.