Capability trait that provides hashing.
The hasher method returns a fresh Hasher
object as a resource. Hasher
is a mutable object that supports incremental computation of hashes.
A Hasher
instance should be created for each hash you want to compute, though Hasher
objects may be reused to compute consecutive hashes. When doing so, care must be taken to ensure no concurrent usage.
The hashWith
operation converts a Resource[F, Hasher[F]]
to a Pipe[F, Byte, Hash]
. The resulting pipe outputs a single Hash
once the source byte stream terminates.
Alternatively, a Resource[F, Hasher[F]]
can be used directly (via .use
or via Stream.resource
). The Hasher[F]
trait provides lower level operations for computing hashes, both at an individual chunk level (via update
and digest
) and at stream level (e.g., via observe
and drain
).
Finally, the Hashing
companion object offers utilities for computing pure hashes: hashPureStream
and hashChunk
.
Attributes
- Companion
- object
- Source
- Hashing.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any