apotheca / botan Goto Github PK
View Code? Open in Web Editor NEWHaskell bindings for the Botan cryptography library
License: BSD 3-Clause "New" or "Revised" License
Haskell bindings for the Botan cryptography library
License: BSD 3-Clause "New" or "Revised" License
The library does not need to throw exceptions on any level.
The control flow when interfacing with a C library inevitably unrolls to
handle (\(BotanException r) -> pure r) $ do
r0 <- botan_foo
if r0 < 0
then throw $ BotanException r0
else do
r1 <- botan_bar
...
so you can skip all the busywork and just write the following instead
r0 <- botan_foo
if r0 < 0
then pure r0
else do
r1 <- botan_bar
...
Error unification makes the API more complex.
Most of the functions will only have a few Haskell-level errors and library users do not need error interoperability across the entire library. Making each distinct function have its own error type will also allow for better documentation.
Unfortunately Botan API does not version errors, so those will have to be passed around as CInt
s without clarification.
botan-low
should work over pointers and sizes, not Haskell datatypes.
By creating a basic datatype like Bytes = Bytes (Ptr Word8) Int
you can leave allocations out of this level. Conversions to such datatypes are generic and you don't need to unbox anything, the simplifier will inline the datatype for you.
botan-low
can store algorithm names raw using MagicHash
: the format is Ptr "Foo\0"#
, the result is a C string.
Preludes and default extensions are bad practices.
It's easy to add an extra import to a custom prelude, it's hard to remove it, so over time these things bloat, slowing down everything and making the library harder to navigate. Consider creating special modules for functions that need to be shared and inlining function wrappers.
Algorithm enumerations may be harmful on the high level, as the C library may not support certain algorithms or support ones you didn't expect.
Tests do not need to rely on packages they're in, you can share the source files instead.
This also allows you to test internal modules without exposing them.
botan.cabal mentions Botan.KeyWrap
but no such module seems to be in the repository.
Hey,
I think it would be nice if the library used ByteStringS instead of memory
. Any particular reason you chose to use it? IIUC memory
suffers from similar fate other Vincent's libraries do.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.