Feature Request: pure, incremental hashing
Opened this issue · 0 comments
axman6 commented
Cryptonite/crypton provide a nice interface for incremental hashing via the API (unnecessary type indirection removed for clarity):
hashInit :: HashAlgorithm a => Context a
hashUpdates :: HashAlgorithm a => Context a -> [ByteString] -> Context a
hashUpdate :: HashAlgorithm a => Context a -> ByteString -> Context a
hashFinalize :: HashAlgorithm a => Context a -> Digest a
Currently, botan-low (and botan) only provide an interface that requires MonadIO
, which makes rewriting functions like amazonka-core
's sinkHash
difficult*. Hashing is morally pure, even if under the hood IO actions are being called. The provided IncrementalHash
class is too high level to really be that useful. It can be written using unsafePerformIO fairly easily, but the API above is much easier to work with.
* I would be surprised if it's actually ever used in a context where m
doesn't have MonadIO
, but that's beside the point.