zeroize

Securely clear secrets from memory using a simple trait that resists compiler optimization

Library
Cargo
v1.9.0
659stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
73/100Good
Development Activity80
Maintenance40
Community84
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture78
Code Quality80
Innovation75
Learning Curve82

zeroize is the RustCrypto project’s crate for securely zeroing memory that holds secrets — passwords, keys, or any sensitive buffer — in a way that the compiler cannot silently optimize away. Ordinary memory writes intended to clear a secret are a classic target for dead-store elimination, since the compiler sees no further reads of the value; zeroize instead uses core::ptr::write_volatile and core::sync::atomic memory fences to force the write through, without relying on FFI, inline assembly, or platform-specific tricks.

The crate is no_std by default, has zero required dependencies, and works on WASM as well as embedded targets, making it usable anywhere from a bare-metal firmware image to a server-side cryptography stack. An optional derive feature (zeroize_derive) generates Zeroize/ZeroizeOnDrop implementations for structs and enums so an entire data structure can be cleared with one call or automatically zeroed when it goes out of scope. As one of the RustCrypto project’s foundational utility crates, zeroize is a near-universal dependency across the Rust cryptography ecosystem — used by TLS, key-management, and cryptocurrency wallet code wherever secret material needs to be reliably erased.

What You Get

  • A Zeroize trait implemented for Rust’s core numeric types, arrays, and slices, callable with a single .zeroize() method
  • #![no_std] support with no required dependencies, usable in embedded, WASM, and bare-metal contexts
  • An optional zeroize_derive-powered #[derive(Zeroize, ZeroizeOnDrop)] for automatically clearing whole structs and enums
  • Pure-Rust implementation using core::ptr::write_volatile and memory fences — no FFI, no inline assembly, no platform-specific code paths
  • Optional alloc/std feature flags for zeroizing heap-allocated collections like Vec and String

Common Use Cases

  • Clearing password buffers, private keys, or session tokens from memory immediately after use
  • Implementing Drop for structs holding cryptographic key material so secrets are erased automatically when they go out of scope
  • Building higher-level cryptography or key-management crates that need a dependable, audited zeroing primitive rather than rolling their own
  • Embedded and WASM cryptography where FFI-based zeroing tricks (e.g. calling explicit_bzero) aren’t available

Under The Hood

Architecture The crate centers on a single Zeroize trait defined in src/lib.rs (856 lines), implemented for primitive numeric types, fixed-size arrays, and slices, plus optional alloc/std implementations for Vec/String-like types gated behind feature flags. src/barrier.rs (102 lines) provides the core volatile-write-plus-fence primitive that the trait implementations call into, while src/aarch64.rs and src/x86.rs hold now-vestigial architecture-specific hooks (the crate’s own comments note these are no-op features retained for compatibility). An optional zeroize_derive proc-macro crate (a sibling in the same workspace) generates Zeroize/ZeroizeOnDrop impls for user-defined structs and enums, keeping the derive logic decoupled from the core zeroing primitive. Tech Stack Pure Rust, no_std by default with alloc/std opt-in features, Rust 2024 edition, MSRV 1.85; the only non-dev dependencies are optional (serde for serialization support, zeroize_derive for the derive macro), and the crate is part of a larger RustCrypto/utils Cargo workspace alongside many sibling utility crates (hex-literal, block-buffer, cpufeatures, etc.). Code Quality tests/ covers the trait’s plain-type implementations (tests/zeroize.rs), heap-allocated types under the alloc feature (tests/alloc.rs), and the derive macro’s generated code (tests/zeroize_derive.rs), giving reasonable confidence across both the manual and derive-based API surfaces. The workspace enforces a strict Clippy/rustc lint set (unsafe_code scrutiny, missing_docs, cast_* lints), and the crate’s core correctness claim — that writes aren’t optimized away — is inherently hard to unit-test and instead relies on documented use of write_volatile/atomic fences rather than empirical benchmarking in CI. API Design The API is deliberately minimal: one trait, one method (.zeroize()), plus an opt-in derive for structs — there’s very little to learn beyond calling .zeroize() on values that hold secrets, and the derive macro removes boilerplate for anyone building their own secret-holding types.

Used by 8 apps in this directory

TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
TypeScript
75%
GPL 3.0

Bramble

Password Manager · Security · Authentication

315

Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.

View details
73
Repo Health
84
Technical
72
Dependency
Built with
TypeScript75%
Updated today
Swift
64%
GPL 3.0

cmux

Developer Tools · AI Development

26,221

A native, Ghostty-based macOS terminal with vertical tabs, agent-aware notifications, and a scriptable browser built for running many parallel AI coding agent sessions instead of juggling tmux panes.

View details
84
Repo Health
81
Technical
72
Dependency
Built with
Swift64%
Rust14%
Updated today
Rust
100%
Other

Fluree DB

Databases

445

A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.

View details
86
Repo Health
74
Technical
65
Dependency
Built with
Rust100%
Updated yesterday
Rust
50%
Other

hoodik

File Storage · Security

1,446

Self-hosted, end-to-end encrypted cloud storage with browser-based encryption and S3-compatible storage support

View details
74
Repo Health
71
Technical
65
Dependency
Built with
Rust50%
TypeScript33%
Vue15%
Updated 4 days ago
Rust
41%
Other

Hook0

Devops

1,477

Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.

View details
83
Repo Health
82
Technical
70
Dependency
Built with
Rust41%
TypeScript17%
JavaScript15%
Updated today
Go
62%
MIT

hoop

Security · Monitoring

791

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
86
Repo Health
80
Technical
66
Dependency
Built with
Go62%
Clojure20%
JavaScript10%
Updated yesterday
Rust
72%
Apache 2.0

mesh-llm

AI Development · AI Agents

3,258

Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.

View details
83
Repo Health
91
Technical
70
Dependency
Built with
Rust72%
TypeScript16%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search