hashutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesOfBytesKeccak

func BytesOfBytesKeccak(b [][]byte) ([32]byte, error)

BytesOfBytesKeccak will compute a keccak256 hash of the provided bytes of bytes slice

func EncodeBytesOfBytes

func EncodeBytesOfBytes(b [][]byte) ([]byte, error)

EncodeBytesOfBytes encodes the nested byte arrays into a single byte array as follows

  1. total number of nested arrays is encoded into fix-size 8 bytes at the front of the result
  2. for each nested array encode the array length into fixed-size 8 bytes, append to result append the array contents to result

Types

type Hash

type Hash interface {
	[32]byte
}

Hash contains all supported hash formats. Add additional hash types e.g. [20]byte as needed here.

type Hasher

type Hasher[H Hash] interface {
	Hash(l []byte) H
	HashInternal(a, b H) H
	ZeroHash() H
}

func NewKeccak

func NewKeccak() Hasher[[32]byte]

Jump to

Keyboard shortcuts

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