keccak

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package keccak implements legacy Keccak secure hash functions.

For a detailed specification see: https://keccak.team.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digest250

func Digest250(data []byte) *big.Int

Digest250 returns the 256-bit Keccak hash of the data with the first 6 bits set to zero. Note that signature differs from standard Go hash functions in that the return type is a *big.Int meant to represent a field element, 𝔽ₚ. See the hash function section of the StarkNet documentation for details.

Example

ExampleDigest showcases the use of the Digest250 function in the autogenerated documentation.

digest := Digest250([]byte("abc"))
fmt.Printf("0x%x\n", digest)
Output:

0x203657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45

func Digest256

func Digest256(data []byte) []byte

Digest256 returns the 256-bit Keccak hash of the data.

Example

ExampleDigest256 showcases the use of the Digest250 function in the autogenerated documentation.

digest := Digest256([]byte("abc"))
fmt.Printf("0x%x\n", digest)
Output:

0x4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45

Types

This section is empty.

Jump to

Keyboard shortcuts

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