#cryptography #nacl #libsodium #xchacha20 #crypto-box

dryoc

dryoc is a pure-Rust general-purpose cryptography library

15 releases

Uses new Rust 2021

0.3.11 Nov 15, 2021
0.3.10 Oct 21, 2021
0.3.8 Apr 18, 2021
0.2.3 Mar 10, 2021
0.1.0 Mar 5, 2021

#203 in Cryptography

49 downloads per month
Used in bitbottle

LGPL-3.0-only

490KB
9K SLoC

Docs Crates.io Build & test Codecov

💬 Join the Matrix chat

dryoc: Don't Roll Your Own Crypto™[^1]

dryoc is a pure-Rust, general-purpose cryptography library. It's provides an implementation of the excellent libsodium library, in pure Rust.

Granny says no

The purpose of this project is to provide a pure-Rust, mostly drop-in replacement for libsodium. This library has nearly the same ergonomics as libsodium (referred to in dryoc as the Classic API), such that people familiar with libsodium can use this library nearly interchangeably. While the API is not 100% identical to libsodium, most functions have the same or very similar signatures.

In addition to the Classic API, there's a Rustaceous API which aims to bring an idiomatic Rust implementation of libsodium's core features: public and secret key authenticated cryptography and general-purpose cryptography tools.

Not all features from libsodium are implemented here, either because there exist better implementations in other crates, or because they aren't necessary as part of this crate.

Additionally, this crate provides exceptionally safe cryptography thanks to Rust's safety features. The Rustaceous API is designed designed to make it difficult to shoot yourself in the foot. It's worth noting, however, you certainly can still shoot yourself if you choose (either by leaking private data, using insecure hardware, OPSEC issues, etc).

Features

  • Many libsodium implemented with both Classic and Rustaceous API
  • Protected memory handling
  • Serde support (with features = ["serde"])

Project status

The following libsodium features are currently implemented, or awaiting implementation:

The following libsodium features are either incomplete, not exposed as public APIs, or not implemented; you may find equivalent functionality in other crates:

Stargazers over time

Stargazers over time

Other NaCl-related Rust implementations worth mentioning

[^1]: Not actually trademarked.

Dependencies

~2.2–3MB
~65K SLoC