Botan bindings devlog

Another day, another module! This time, it’s Random number generators!

The repo has of course also been updated, with the following:

  • Added Botan.Random (the RNG interface)
    • The Random random number generator opaque type
    • The RandomType type for specifying the type of Random
    • randomInit and randomInitWith functions to create a Random
    • randomGet and systemRandomGet functions for getting n bytes of random.
    • randomReseed and randomReseedFromRandom reseeding functions
    • randomAddEntropy function for adding your own bytes of entropy
    • NOTE: botan_rng_init_custom function is not implemented. It looks complicated, for now.
  • Switched a few alloc to malloc because long-lived references were being freed*
  • Added pure hashWith convenience method

* If someone could sanity check the ForeignPtr initialization pattern I’m using, I would appreciate it.


If there are any particular modules that you would like me to tackle next, or if you would instead like me to focus a little more on developing some higher-level bindings to Hash / Random, please let me know. Otherwise, I’m following the Botan FFI header which means that message authentication codes aka MAC would be the next module. I’m open to listening to the community on this :slight_smile:

8 Likes