Keccak

scalus.crypto.Keccak
object Keccak

Pure Scala implementation of Keccak-256 and SHA3-256 hash functions.

Implementation follows NIST FIPS 202 and is cross-checked with BouncyCastle.

The Keccak-f[1600] permutation operates on a 1600-bit state (25 × 64-bit lanes). For 256-bit output with capacity 512, the rate is 1088 bits (136 bytes).

The only difference between Keccak-256 and SHA3-256 is the domain separation suffix:

  • Keccak-256: suffix 0x01
  • SHA3-256: suffix 0x06

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Keccak.type

Members list

Value members

Concrete methods

def keccak256(input: Array[Byte]): Array[Byte]

Compute Keccak-256 hash (used by Ethereum).

Compute Keccak-256 hash (used by Ethereum).

Value parameters

input

the input bytes

Attributes

Returns

32-byte hash

def sha3_256(input: Array[Byte]): Array[Byte]

Compute SHA3-256 hash (NIST FIPS 202).

Compute SHA3-256 hash (NIST FIPS 202).

Value parameters

input

the input bytes

Attributes

Returns

32-byte hash