Skip to content

Commit

Permalink
Merge pull request #3467 from mpilquist/topic/digest
Browse files Browse the repository at this point in the history
Refactor hashPureStream
  • Loading branch information
mpilquist committed Aug 26, 2024
2 parents f8e2a33 + f093905 commit ff9b4d1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions core/shared/src/main/scala/fs2/hashing/Hashing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ object Hashing {

/** Returns the hash of the supplied stream. */
def hashPureStream(algorithm: HashAlgorithm, source: Stream[Pure, Byte]): Hash =
Hashing[SyncIO]
.hasher(algorithm)
.use(h => h.drain(source).compile.lastOrError)
.unsafeRunSync()
source.through(Hashing[SyncIO].hash(algorithm)).compile.lastOrError.unsafeRunSync()

/** Returns the hash of the supplied chunk. */
def hashChunk(algorithm: HashAlgorithm, chunk: Chunk[Byte]): Hash =
Expand Down

0 comments on commit ff9b4d1

Please sign in to comment.