{"id":13611753,"url":"https://github.com/brndnmtthws/dryoc","last_synced_at":"2025-05-15T02:03:31.661Z","repository":{"id":46153766,"uuid":"322910160","full_name":"brndnmtthws/dryoc","owner":"brndnmtthws","description":"Don't Roll Your Own Crypto: pure-Rust, hard to misuse cryptography library","archived":false,"fork":false,"pushed_at":"2025-05-02T01:24:39.000Z","size":1237,"stargazers_count":308,"open_issues_count":3,"forks_count":18,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-02T01:27:41.441Z","etag":null,"topics":["crypto","cryptography","cryptography-library","libsodium","nacl","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/dryoc","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brndnmtthws.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"brndnmtthws"}},"created_at":"2020-12-19T18:16:33.000Z","updated_at":"2025-05-02T01:24:41.000Z","dependencies_parsed_at":"2024-01-14T06:50:50.083Z","dependency_job_id":"f58c6f41-7477-40e2-93da-8bbe5564541f","html_url":"https://github.com/brndnmtthws/dryoc","commit_stats":{"total_commits":355,"total_committers":9,"mean_commits":39.44444444444444,"dds":"0.11830985915492953","last_synced_commit":"89219acc4efd7154cf0b0a6550e60f6e01635770"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brndnmtthws%2Fdryoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brndnmtthws%2Fdryoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brndnmtthws%2Fdryoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brndnmtthws%2Fdryoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brndnmtthws","download_url":"https://codeload.github.com/brndnmtthws/dryoc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259369,"owners_count":22040819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto","cryptography","cryptography-library","libsodium","nacl","rust"],"created_at":"2024-08-01T19:02:04.770Z","updated_at":"2025-05-15T02:03:31.623Z","avatar_url":"https://github.com/brndnmtthws.png","language":"Rust","funding_links":["https://github.com/sponsors/brndnmtthws"],"categories":["Rust","Frameworks and Libs","cryptography"],"sub_categories":["Rust"],"readme":"[![Docs](https://docs.rs/dryoc/badge.svg)](https://docs.rs/dryoc) [![Crates.io](https://img.shields.io/crates/v/dryoc)](https://crates.io/crates/dryoc) [![Build \u0026 test](https://github.com/brndnmtthws/dryoc/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/brndnmtthws/dryoc/actions/workflows/build-and-test.yml) [![Codecov](https://img.shields.io/codecov/c/github/brndnmtthws/dryoc)](https://app.codecov.io/gh/brndnmtthws/dryoc/)\n\n[💬 Join the Matrix chat](https://matrix.to/#/#dryoc:frens.io)\n\n# dryoc: Don't Roll Your Own Crypto™\u003csup\u003e[^1]\u003c/sup\u003e\n\ndryoc is a pure-Rust, general-purpose cryptography library that's hard to misuse. It's based on the excellent\n[libsodium](https://github.com/jedisct1/libsodium) library, but in _pure_ Rust. It\nalso includes protected memory features throughout, which makes it dead simple\nto build secure, robust, and safe cryptographic software. The original goal of this library was to provide a pure-Rust alternative to libsodium.\n\n![Granny says no](dryoc.png)\n\nThe purpose of this project is to provide a pure-Rust, mostly drop-in\nreplacement for libsodium. This library has nearly the same ergonomics as\nlibsodium (referred to in dryoc as the _Classic_ API), such that people\nfamiliar with libsodium can use this library nearly interchangeably. While\nthe API is not 100% identical to libsodium, most functions have the same or\nvery similar signatures.\n\nIn addition to the Classic API, there's a _Rustaceous_ API which aims to bring\nan idiomatic Rust implementation of libsodium's core features: public and\nsecret key authenticated cryptography and general-purpose cryptography tools.\n\nNot all features from libsodium are implemented here, either because there\nexist better implementations in other crates, or because they aren't\nnecessary as part of this crate.\n\nAdditionally, this crate provides exceptionally safe cryptography thanks to\nRust's safety features. The Rustaceous API is designed designed to make it\ndifficult to shoot yourself in the foot. It's worth noting, however, you\ncertainly can still shoot yourself if you choose (either by leaking private\ndata, using insecure hardware, OPSEC issues, etc).\n\nFor example usage, refer to the\n[official docs](https://docs.rs/dryoc/latest/dryoc/) or the\n[integration tests](/tests/integration_tests.rs).\n\n## Features\n\n* 100% pure Rust, no hidden C libraries\n* mostly free of unsafe code[^2]\n* Hard to misuse, helping you avoid common costly cryptography mistakes\n* Many libsodium features implemented with both Classic and Rustaceous API\n* Protected memory handling (`mprotect()` + `mlock()`, along with Windows equivalents)\n* [Serde](https://serde.rs/) support (with `features = [\"serde\"]`)\n* [_Portable_ SIMD](https://doc.rust-lang.org/std/simd/index.html) implementation for Blake2b (used by generic hashing, password hashing, and key derivation) on nightly, with `features = [\"simd_backend\", \"nightly\"]`\n* SIMD backend for Curve25519 (used by public/private key functions) on nightly with `features = [\"simd_backend\", \"nightly\"]`\n* [SHA2](https://github.com/RustCrypto/hashes/tree/master/sha2) (used by sealed boxes) includes SIMD implementation for AVX2\n* [ChaCha20](https://github.com/RustCrypto/stream-ciphers/tree/master/chacha20) (used by streaming interface) includes SIMD implementations for Neon, AVX2, and SSE2\n\nTo enable all the SIMD backends through 3rd party crates, you'll need to also\nset `RUSTFLAGS`:\n* For AVX2 set `RUSTFLAGS=-Ctarget-cpu=haswell -Ctarget-feature=+avx2`\n* For SSE2 set `RUSTFLAGS=-Ctarget-feature=+sse2`\n* For Neon set `RUSTFLAGS=-Ctarget-feature=+neon`\n\n_Note that eventually this project will converge on portable SIMD implementations\nfor all the core algos which will work across all platforms supported by LLVM,\nrather than relying on hand-coded assembly or intrinsics, but this is a work in\nprogress_.\n\n## Project status\n\nThe following libsodium features are currently implemented, or awaiting\nimplementation:\n\n* [x] [Public-key cryptography](https://docs.rs/dryoc/latest/dryoc/dryocbox/index.html) (`crypto_box_*`) [libsodium link](https://doc.libsodium.org/public-key_cryptography)\n* [x] [Secret-key cryptography](https://docs.rs/dryoc/latest/dryoc/dryocsecretbox/index.html) (`crypto_secretbox_*`) [libsodium link](https://doc.libsodium.org/secret-key_cryptography)\n* [x] [Point*scalar multiplication](https://docs.rs/dryoc/latest/dryoc/classic/crypto_core/index.html) (`crypto_scalarmult*`) [libsodium link](https://doc.libsodium.org/advanced/scalar_multiplication)\n* [x] Zeroing memory (`sodium_memzero`) with [zeroize](https://crates.io/crates/zeroize) [libsodium link](https://doc.libsodium.org/memory_management)\n* [x] [Generating random data](https://docs.rs/dryoc/latest/dryoc/rng/index.html) (`randombytes_buf`) [libsodium link](https://doc.libsodium.org/generating_random_data)\n* [x] [Encrypted streams](https://docs.rs/dryoc/latest/dryoc/dryocstream/index.html) (`crypto_secretstream_*`) [libsodium link](https://doc.libsodium.org/secret-key_cryptography/secretstream)\n* [x] [Memory locking](https://docs.rs/dryoc/latest/dryoc/protected/index.html) (`sodium_mlock`, `sodium_munlock`, `sodium_mprotect_*`) [libsodium link](https://doc.libsodium.org/memory_management)\n* [x] [Encrypting related messages](https://docs.rs/dryoc/latest/dryoc/utils/fn.increment_bytes.html) (`sodium_increment`) [libsodium link](https://doc.libsodium.org/secret-key_cryptography/encrypted-messages)\n* [x] [Generic hashing](https://docs.rs/dryoc/latest/dryoc/generichash/index.html) (`crypto_generichash_*`) [libsodium link](https://doc.libsodium.org/hashing/generic_hashing)\n* [x] [Secret-key authentication](https://docs.rs/dryoc/latest/dryoc/auth/index.html) (`crypto_auth*`) [libsodium link](https://doc.libsodium.org/secret-key_cryptography/secret-key_authentication)\n* [x] [One-time authentication](https://docs.rs/dryoc/latest/dryoc/onetimeauth/index.html) (`crypto_onetimeauth_*`) [libsodium link](https://doc.libsodium.org/advanced/poly1305)\n* [x] [Sealed boxes](https://docs.rs/dryoc/latest/dryoc/dryocbox/struct.DryocBox.html#method.seal) (`crypto_box_seal*`) [libsodium link](https://doc.libsodium.org/public-key_cryptography/sealed_boxes)\n* [x] [Key derivation](https://docs.rs/dryoc/latest/dryoc/kdf/index.html) (`crypto_kdf_*`) [libsodium link](https://doc.libsodium.org/key_derivation)\n* [x] [Key exchange](https://docs.rs/dryoc/latest/dryoc/kx/index.html) (`crypto_kx_*`) [libsodium link](https://doc.libsodium.org/key_exchange)\n* [x] [Public-key signatures](https://docs.rs/dryoc/latest/dryoc/sign/index.html) (`crypto_sign_*`) [libsodium link](https://doc.libsodium.org/public-key_cryptography/public-key_signatures)\n* [x] [Ed25519 to Curve25519](https://docs.rs/dryoc/latest/dryoc/classic/crypto_sign_ed25519/index.html) (`crypto_sign_ed25519_*`) [libsodium link](https://doc.libsodium.org/advanced/ed25519-curve25519)\n* [x] [Short-input hashing](https://docs.rs/dryoc/latest/dryoc/classic/crypto_shorthash/index.html) (`crypto_shorthash`) [libsodium link](https://doc.libsodium.org/hashing/short-input_hashing)\n* [x] [Password hashing](https://docs.rs/dryoc/latest/dryoc/pwhash/index.html) (`crypto_pwhash_*`) [libsodium link](https://doc.libsodium.org/password_hashing/default_phf)\n\nThe following libsodium features are either incomplete, not exposed as public\nAPIs, or not implemented; you may find equivalent functionality in other\ncrates:\n\n* [Stream ciphers](https://doc.libsodium.org/advanced/stream_ciphers) (use [salsa20](https://crates.io/crates/salsa20) crate directly instead)\n* [Helpers](https://doc.libsodium.org/helpers) and [padding](https://doc.libsodium.org/padding) utilities\n* [Advanced features](https://doc.libsodium.org/advanced):\n  * [Scrypt](https://doc.libsodium.org/advanced/scrypt) (use [scrypt](https://crates.io/crates/scrypt) crate directly instead)\n  * [Finite field arithmetic](https://doc.libsodium.org/advanced/point-arithmetic) (try the [curve25519-dalek](https://crates.io/crates/curve25519-dalek) crate)\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/brndnmtthws/dryoc.svg)](https://starchart.cc/brndnmtthws/dryoc)\n\n## Other NaCl-related Rust implementations worth mentioning\n\n* [sodiumoxide](https://crates.io/crates/sodiumoxide)\n* [crypto_box](https://crates.io/crates/crypto_box)\n\n[^1]: Not actually trademarked.\n\n[^2]: The protected memory features described in the [protected] mod require\ncustom memory allocation, system calls, and pointer arithmetic, which are unsafe\nin Rust. Some of the 3rd party libraries used by this crate, such as those with\nSIMD, may contain unsafe code. In particular, most SIMD implementations are\nconsidered \"unsafe\" due to their use of assembly or intrinsics, however without\nSIMD-based cryptography you may be exposed to timing attacks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrndnmtthws%2Fdryoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrndnmtthws%2Fdryoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrndnmtthws%2Fdryoc/lists"}