bytesutil

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 3 Imported by: 36

README

go-bytesutil

Tag License GoDoc Travis CI codecov.io

Go library providing common byte manipulation utilities.

Table of Contents

Install

go-bytesutil is a standard Go module which can be installed with:

go get github.com/wealdtech/go-bytesutil

Usage

Documentation is at https://godoc.org/github.com/wealdtech/go-bytesutil

Example

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0 © 2019 Weald Technology Trading Ltd

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes1

func Bytes1(val uint64) []byte

Bytes1 returns the first byte of the little-endian representation of the supplied value.

func Bytes16

func Bytes16(x uint64) []byte

Bytes16 returns the first sixteen bytes of the little-endian representation of the supplied value.

func Bytes2

func Bytes2(val uint64) []byte

Bytes2 returns the first two bytes of the little-endian representation of the supplied value.

func Bytes32

func Bytes32(x uint64) []byte

Bytes32 returns the first thirty-two bytes of the little-endian representation of the supplied value.

func Bytes4

func Bytes4(x uint64) []byte

Bytes4 returns the first four bytes of the little-endian representation of the supplied value.

func Bytes64 added in v1.1.1

func Bytes64(x uint64) []byte

Bytes64 returns the first thirty-two bytes of the little-endian representation of the supplied value.

func Bytes8

func Bytes8(x uint64) []byte

Bytes8 returns the first eight bytes of the little-endian representation of the supplied value.

func FromHexString added in v1.1.0

func FromHexString(data string) ([]byte, error)

FromHexString returns a byte array given a hex string

func ToBytes16

func ToBytes16(val []byte) [16]byte

ToBytes16 returns a 16-byte array with the supplied value placed in the low-order indices.

func ToBytes32

func ToBytes32(val []byte) [32]byte

ToBytes32 returns a 32-byte array with the supplied value placed in the low-order indices.

func ToBytes48

func ToBytes48(val []byte) [48]byte

ToBytes48 returns a 48-byte array with the supplied value placed in the low-order indices.

func ToBytes64

func ToBytes64(val []byte) [64]byte

ToBytes64 returns a 64-byte array with the supplied value placed in the low-order indices.

func ToBytes8

func ToBytes8(val []byte) [8]byte

ToBytes8 returns an 8-byte array with the supplied value placed in the low-order indices.

func ToBytes96

func ToBytes96(val []byte) [96]byte

ToBytes96 returns a 96-byte array with the supplied value placed in the low-order indices.

func XOR added in v1.0.1

func XOR(data []byte) []byte

XOR returns an XORd copy of the bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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