Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: pure, incremental hashing #15

Open
axman6 opened this issue Apr 5, 2024 · 0 comments
Open

Feature Request: pure, incremental hashing #15

axman6 opened this issue Apr 5, 2024 · 0 comments

Comments

@axman6
Copy link

axman6 commented Apr 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant