Hasher

fs2.hashing.Hasher
See theHasher companion object
trait Hasher[F[_]]

Mutable data structure that incrementally computes a hash from chunks of bytes.

To compute a hash, call update one or more times and then call hash. The result of hash is the hash value of all the bytes since the last call to hash.

A Hasher does **not** store all bytes between calls to hash and hence is safe for computing hashes over very large data sets using constant memory.

A Hasher may be called from different fibers but operations on a hash should not be called concurrently.

Attributes

Companion
object
Source
Hasher.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def hash: F[Hash]

Finalizes the hash computation, returns the result, and resets this hasher for a fresh computation.

Finalizes the hash computation, returns the result, and resets this hasher for a fresh computation.

Attributes

Source
Hasher.scala
def update(bytes: Chunk[Byte]): F[Unit]

Adds the specified bytes to the current hash computation.

Adds the specified bytes to the current hash computation.

Attributes

Source
Hasher.scala

Concrete methods

def drain: (F, Byte) => Hash

Returns a pipe that outputs the hash of the source.

Returns a pipe that outputs the hash of the source.

Attributes

Source
Hasher.scala
def observe(sink: (F, Byte) => Nothing): (F, Byte) => Hash

Returns a pipe that observes chunks from the source to the supplied sink, updating this hash with each observed chunk.

Returns a pipe that observes chunks from the source to the supplied sink, updating this hash with each observed chunk. At completion of the source and sink, a single hash is emitted.

Attributes

Source
Hasher.scala
def update: (F, Byte) => Byte

Returns a pipe that updates this hash computation with chunks of bytes pulled from the pipe.

Returns a pipe that updates this hash computation with chunks of bytes pulled from the pipe.

Attributes

Source
Hasher.scala
def verify(expected: Hash): (F, Byte) => Byte

Returns a pipe that, at termination of the source, verifies the hash of seen bytes matches the expected value or otherwise fails with a HashVerificationException.

Returns a pipe that, at termination of the source, verifies the hash of seen bytes matches the expected value or otherwise fails with a HashVerificationException.

Attributes

Source
Hasher.scala