All Projects → brndnmtthws → dryoc

brndnmtthws / dryoc

Licence: LGPL-3.0, Unknown licenses found Licenses found LGPL-3.0 LICENSE Unknown COPYING
Don't Roll Your Own Crypto: pure-Rust, hard to misuse cryptography library

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to dryoc

sodalite
tweetnacl in rust
Stars: ✭ 26 (-84.05%)
Mutual labels:  libsodium, nacl
libgodium
Pure Go implementation of cryptographic APIs found in libsodium
Stars: ✭ 46 (-71.78%)
Mutual labels:  libsodium, cryptography-library
salty
Portable NaCl-powered encryption
Stars: ✭ 26 (-84.05%)
Mutual labels:  libsodium, nacl
Tweetnacl Js
Port of TweetNaCl cryptographic library to JavaScript
Stars: ✭ 1,176 (+621.47%)
Mutual labels:  libsodium
Flutter sodium
Flutter bindings for libsodium
Stars: ✭ 77 (-52.76%)
Mutual labels:  libsodium
Enacl
Erlang bindings for NaCl / libsodium
Stars: ✭ 159 (-2.45%)
Mutual labels:  libsodium
Libsodium Jni
(Android) Networking and Cryptography Library (NaCL) JNI binding. JNI is utilized for fastest access to native code. Accessible either in Android or Java application. Uses SWIG to generate Java JNI bindings. SWIG definitions are extensible to other languages.
Stars: ✭ 157 (-3.68%)
Mutual labels:  libsodium
Paseto.rb
Ruby implementation of Paseto using libsodium.
Stars: ✭ 41 (-74.85%)
Mutual labels:  libsodium
Learntocrypto
Learn to crypto workshop
Stars: ✭ 1,687 (+934.97%)
Mutual labels:  libsodium
Encryptedrmd
🔑 Password protected markdown html reports in R using libsodium
Stars: ✭ 136 (-16.56%)
Mutual labels:  libsodium
Nsec
A modern and easy-to-use cryptographic library for .NET Core based on libsodium
Stars: ✭ 217 (+33.13%)
Mutual labels:  libsodium
Signatory
Multi-provider digital signature library for Rust
Stars: ✭ 136 (-16.56%)
Mutual labels:  libsodium
Chloride
Stars: ✭ 83 (-49.08%)
Mutual labels:  libsodium
Kalium
Java binding to the Networking and Cryptography (NaCl) library with the awesomeness of libsodium
Stars: ✭ 203 (+24.54%)
Mutual labels:  libsodium
Zbox
Zero-details, privacy-focused in-app file system.
Stars: ✭ 1,185 (+626.99%)
Mutual labels:  libsodium
python-mbedtls
Cryptographic library with an mbed TLS back end
Stars: ✭ 64 (-60.74%)
Mutual labels:  cryptography-library
Lazysodium Android
An Android implementation of the Libsodium cryptography library. For the lazy dev.
Stars: ✭ 69 (-57.67%)
Mutual labels:  libsodium
Streamcryptor
Stream encryption & decryption with libsodium and protobuf
Stars: ✭ 112 (-31.29%)
Mutual labels:  libsodium
soda
Libsodium bindings for Erlang
Stars: ✭ 17 (-89.57%)
Mutual labels:  libsodium
molch
An implementation of the axolotl ratchet based on libsodium.
Stars: ✭ 24 (-85.28%)
Mutual labels:  libsodium

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 that's hard to misuse. It's based on the excellent libsodium library, but in pure Rust. It also includes protected memory features throughout, which makes it dead simple to build secure, robust, and safe cryptographic software. The original goal of this library was to provide a pure-Rust alternative to libsodium.

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).

For example usage, refer to the official docs or the integration tests.

Features

  • 100% pure Rust, no hidden C libraries
  • mostly free of unsafe code2
  • Hard to misuse, helping you avoid common costly cryptography mistakes
  • Many libsodium features implemented with both Classic and Rustaceous API
  • Protected memory handling (mprotect() + mlock(), along with Windows equivalents)
  • Serde support (with features = ["serde"])
  • Portable SIMD implementation for Blake2b (used by generic hashing, password hashing, and key derivation) on nightly, with features = ["simd_backend", "nightly"]
  • SIMD backend for Curve25519 (used by public/private key functions) on nightly with features = ["simd_backend", "nightly"]
  • SHA2 (used by sealed boxes) includes SIMD implementation for AVX2
  • ChaCha20 (used by streaming interface) includes SIMD implementations for Neon, AVX2, and SSE2

To enable all the SIMD backends through 3rd party crates, you'll need to also set RUSTFLAGS:

  • For AVX2 set RUSTFLAGS=-Ctarget-cpu=haswell -Ctarget-feature=+avx2
  • For SSE2 set RUSTFLAGS=-Ctarget-feature=+sse2
  • For Neon set RUSTFLAGS=-Ctarget-feature=+neon

Note that eventually this project will converge on portable SIMD implementations for all the core algos which will work across all platforms supported by LLVM, rather than relying on hand-coded assembly or intrinsics, but his is a work in progress.

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

Footnotes

  1. Not actually trademarked.

  2. The protected memory features described in the [protected] mod require custom memory allocation, system calls, and pointer arithmetic, which are unsafe in Rust. Some of the 3rd party libraries used by this crate, such as those with SIMD, may contain unsafe code. In particular, most SIMD implementations are considered "unsafe" due to their use of assembly or intrinsics, however without SIMD-based cryptography you may be exposed to timing attacks.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].