fs2.hashing

package fs2.hashing

Members list

Type members

Classlikes

final case class Hash(bytes: Chunk[Byte])

Result of a hash operation.

Result of a hash operation.

Attributes

Source
Hash.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
abstract class HashAlgorithm

Enumeration of hash algorithms.

Enumeration of hash algorithms.

Note: The existence of an algorithm in this list does not guarantee it is supported at runtime, as algorithm support is platform specific.

The Named constructor allows specifying an algorithm name that's not in this list. The supplied name will be passed to the underlying crypto provider when creating a Hasher.

Implementation note: this class is not sealed, and its constructor is private, to allow for addition of new cases in the future without breaking compatibility.

Attributes

Companion
object
Source
HashAlgorithm.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object MD5
class Named
object SHA1
object SHA224
object SHA256
object SHA384
object SHA3_224
object SHA3_256
object SHA3_384
object SHA3_512
object SHA512
object SHA512_224
object SHA512_256
Show all
object HashAlgorithm

Attributes

Companion
class
Source
HashAlgorithm.scala
Supertypes
class Object
trait Matchable
class Any
Self type
case class HashVerificationException(expected: Hash, actual: Hash) extends IOException

Attributes

Source
HashVerificationException.scala
Supertypes
trait Product
trait Equals
class IOException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait Hasher[F[_]]

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

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
Supertypes
class Object
trait Matchable
class Any
object Hasher

Attributes

Companion
trait
Source
Hasher.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Hasher.type
sealed trait Hashing[F[_]]

Capability trait that provides hashing.

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
Supertypes
class Object
trait Matchable
class Any
object Hashing

Attributes

Companion
trait
Source
Hashing.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Hashing.type