fingerprint

package
v0.22.8-patch-3-fix-co... Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: AGPL-3.0 Imports: 1 Imported by: 4 modules, 3 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 Fingerprint

func Fingerprint(entity interface{}) []byte

Fingerprint returns a unique byte representation of the passed interface, which can be used as a pre-image for hashing, signing or creating IDs/identifiers of the entity. By default, MakeID uses RLP to encode the data. If the input defines its own canonical encoding by implementing Fingerprinter, it uses that instead. That allows removal of non-unique fields from structs or overwriting of the used encoder. Fingerprint servers two purposes: a) JSON (the default encoding) does not specify an order for the elements of arrays and objects, which could lead to different hashes of the same entity depending on the JSON implementation and b) the Fingerprinter interface allows to exclude fields not needed in the pre-image of the hash that comprises the Identifier, which could be different from the encoding for sending entities in messages or for storing them.

Types

type Fingerprinter

type Fingerprinter interface {
	Fingerprint() []byte
}

Fingerprinter is a type that allows customization of the data used for the fingerprint of the entity. If a type does not implement Fingerprinter, RLP encoding is used.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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