Documentation ¶
Overview ¶
Package pedersen implements the StarkNet variant of the Pedersen hash function.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayDigest ¶
ArrayDigest returns a field element that is the result of hashing an array of field elements. This is generally used to overcome the limitation of the Digest function which has an upper bound on the amount of field elements that can be hashed. See the [array hashing] section of the StarkNet documentation for more details.
- [array hashing]: https://github.com/golang/proposal/blob/master/design/51082-godocfmt.md
func Digest ¶
Digest returns a field element that is the result of hashing an input (a, b) ∈ 𝔽²ₚ where p = 2²⁵¹ + 17·2¹⁹² + 1. This function will panic if len(data) > 2. In order to hash n > 2 items, use ArrayDigest.
Example ¶
a := new(felt.Felt).SetHex("3d937c035c878245caf64531a5756109c53068da139362728feb561405371cb") b := new(felt.Felt).SetHex("208a0a10250e382e1e4bbe2880906c2791bf6275695e02fbbc6aeff9cd8b31a") fmt.Printf("%s\n", Digest(a, b).Hex())
Output: 30e480bed5fe53fa909cc0f8c4d99b8f9f2c016be4c41e13a4848797979c662
Types ¶
This section is empty.