monosodium 0.1.0-pre.1

Plain bindings to libsodium
Documentation
  • Coverage
  • 0%
    0 out of 153 items documented0 out of 64 items with examples
  • Size
  • Source code size: 1.97 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.09 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 44s Average build duration of successful builds.
  • all releases: 1m 44s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • peterhj/monosodium
    10 2 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • peterhj

monosodium

docs.rs

These are bindings to libsodium. Unlike its namesake, monosodium is rather plain and boring.

Other than the direct bindings to libsodium, the only other abstractions in this crate are in the util module and are centered around a CryptoBuf type for wrapping sensitive bytes; this is described below.

CryptoBuf

util::CryptoBuf is a simple wrapper struct around an inner Vec<u8> buffer. util::CryptoBuf implements PartialEq and Eq (using libsodium's constant-time comparison function sodium_memcmp), implements Drop by zeroing its inner Vec<u8> buffer (using sodium_memzero), and has constructors that initialize its inner buffer with zero-valued bytes or random bytes (using randombytes_buf).

HashCryptoBuf

There is a related struct, util::HashCryptoBuf, that additionally implements Hash.

KeyPair

A public/secret pair of key buffers is encapsulated in a util::KeyPair. This is also the return type of gen_sign_keypair, which is the wrapper around libsodium's crypto_sign_keypair.