Documentation
¶
Index ¶
- func CopyAndReverseEndianess(input []byte) []byte
- func ExtendToSize(slice []byte, length int) []byte
- func PrependExtendToSize(slice []byte, length int) []byte
- func SafeCopy(src []byte) []byte
- func SafeCopy2D(src [][]byte) [][]byte
- func ToBytes32(input []byte) [32]byte
- func ToBytes48(input []byte) [48]byte
- func ToBytes96(input []byte) [96]byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyAndReverseEndianess ¶
CopyAndReverseEndianess will copy the input byte slice and return the flipped version of it.
func ExtendToSize ¶
ExtendToSize extends a byte slice to a specified length. It returns the original slice if it's already larger.
func PrependExtendToSize ¶
PrependExtendToSize extends a byte slice to a specified length by prepending zero bytes. It returns the original slice if it's already larger.
func SafeCopy ¶
SafeCopy creates a copy of the provided byte slice. If the input slice is non-nil and has a length of 32 bytes, it assumes the slice represents a hash and copies it into a fixed-size array before returning a slice of that array. For other non-nil slices, it returns a dynamically allocated copy. If the input slice is nil, it returns nil.
func SafeCopy2D ¶
SafeCopy2D creates a copy of a two-dimensional byte slice. It iterates over the outer slice, copying each inner slice using SafeCopy. If the input is non-nil, it returns a copy of the two-dimensional slice. If the input is nil, it returns nil.
func ToBytes32 ¶
ToBytes32 is a utility function that transforms a byte slice into a fixed 32-byte array. If the input exceeds 32 bytes, it gets truncated.
Types ¶
This section is empty.