hashutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 3 Imported by: 3 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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