hash

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: AGPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LeafResultsHex = "1f72c52b6e5dedca4f99ecfa24f2776732431e8d544e14c6f78f5042727c4657"
)

Results leaf is a constant derived from ZERO_BALLOT_HASH:

leafResults = H_3(KEY_RESULTS, ZERO_BALLOT_HASH, LEAF_DOMAIN)
View Source
const ZeroBallotHashHex = "2c66ee3d8ff0f86c2251e885d4c207e5162c05d0b458c773106cd5579c58bf36"

ZeroBallotHashHex (a.k.a ZERO_BALLOT_HASH) is the Poseidon hash of 8 fields where each field is the 4-tuple (0, 1, 0, 1) (babyjubjub identity points):

zeroBallotValues = [
 0,1,0,1,  0,1,0,1,  0,1,0,1,  0,1,0,1,
 0,1,0,1,  0,1,0,1,  0,1,0,1,  0,1,0,1
]

Variables

This section is empty.

Functions

func PoseidonHash

func PoseidonHash(inputs ...*big.Int) (*big.Int, error)

PoseidonHash hashes the provided inputs with iden3 Poseidon.

func PoseidonMultiHash

func PoseidonMultiHash(inputs []*big.Int) (*big.Int, error)

PoseidonMultiHash matches the multiposeidon logic used in circuits (16-wide chunks).

func StateRoot

func StateRoot(processID, censusOrigin, pubKeyX, pubKeyY, ballotMode *big.Int) (*big.Int, error)

StateRoot computes the state root hash for the process parameters.

func TruncateToLowerBits

func TruncateToLowerBits(input *big.Int, bits uint) *big.Int

TruncateToLowerBits returns a big.Int truncated to the least-significant `bits`.

func VoteID

func VoteID(processID, address, k *big.Int) (*big.Int, error)

VoteID calculates the poseidon hash of processID, address, and k. The hash is truncated to VoteIDHashBits and shifted into the upper half.

Types

This section is empty.

Jump to

Keyboard shortcuts

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