Hey @ApothecaLabs, is there a good place to chat with you/the botan devs about development? I’m currently working through seeing how feasible it would be to swap crypton for botan in amazonka, and I’m running into a lot of issues with the design of the hashing API. I was wondering if there’s a good IRC channel or somewhere to chat - here feels like the wrong place but I can do that if needed.
Quick summary of the issues:
- There’s no pure, incremental hashing API (you probably say my GitHub issue), which makes writing things like pure streaming sinks difficult -
Monad m => Conduit ByteString () m (Digest a)
can’t currently be written, it needsMonadIO
instead (and with the current assumption that all hash state will be mutable updated, there could be bugs in how something that would get used, depending onm
).
As an aside here, linear types would make this API both pure and quite nice to work with - it probably shouldn’t be the only interface, but it would avoid the required copying of the context that a pure API would necessitate - The
Digest
data family is difficult to work with generically, it’s nearly impossible to write something that works on the wrappedByteString
s in functions with types likeHash a => Digest a -> ByteString
. I’d love to see a functiondigestBytes :: Digest a -> ByteString
added to theHash
class, at the very least. - I’ve also grown quite fond of
memory
'sByteArrayAccess
class and its ability to abstract types like digests soo they can easily be hashed too. I think that cryptonite got a lot write with its use ofmemory
, forcing everything to be aByteString
limits things a lot for production code.
I’m sure I’ll run into more, but this is where I am at the moment. I’m aware that botan
is unreleased, but wanted to at least investigate whether it’ll be usable in Amazonka. At the moment there isn’t a clear path that wouldn’t affect performance.
I should also mention that I’m happy to contribute the development of the changes I’d like to see - I should make a fork start playing around with ideas.