Hash

org.sigilaris.core.crypto.Hash
See theHash companion object
trait Hash[A]

Type class for Keccak-256 hashing.

Provides a type-safe way to hash values of type A, returning a tagged hash value that remembers its source type. The hash is computed using Keccak-256 (32 bytes).

Type parameters

A

the type of value to hash

Attributes

See also

CryptoOps.keccak256 for the underlying hash function

Example
 import Hash.ops.*
 // Hash a UTF-8 string
 val utf8Hash: Hash.Value[Utf8] = Utf8("hello").toHash
 // Build custom hash instance
 given Hash[MyType] = Hash.build[MyType]
Companion
object
Source
Hash.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def apply(a: A): Value[A]

Computes the Keccak-256 hash of a value.

Computes the Keccak-256 hash of a value.

Value parameters

a

value to hash

Attributes

Returns

32-byte hash as Hash.Value

Source
Hash.scala

Concrete methods

def contramap[B](f: B => A): Hash[B]

Derives a hash instance for type B via a conversion function.

Derives a hash instance for type B via a conversion function.

Value parameters

f

conversion function from B to A

Attributes

Returns

hash instance for type B

Source
Hash.scala