| Crates.io | poly1305-nostd |
| lib.rs | poly1305-nostd |
| version | 0.1.0 |
| created_at | 2025-12-22 11:25:22.806079+00 |
| updated_at | 2025-12-22 11:25:22.806079+00 |
| description | Pure-Rust Poly1305 MAC implementation for no_std/bare-metal targets (avoids LLVM SIMD issues) |
| homepage | https://github.com/artst3in/poly1305-nostd |
| repository | https://github.com/artst3in/poly1305-nostd |
| max_upload_size | |
| id | 1999580 |
| size | 27,623 |
Pure-Rust Poly1305 MAC implementation for no_std and bare-metal targets.
The standard poly1305 crate (from RustCrypto) fails to compile on certain bare-metal targets like x86_64-unknown-none with LLVM errors:
LLVM ERROR: Do not know how to split the result of this operator!
This happens because the crate uses SIMD intrinsics that aren't available on all targets. This pure-Rust implementation avoids SIMD entirely, making it portable to any Rust target.
no_std compatible: Works in bare-metal and embedded environmentsAdd to your Cargo.toml:
[dependencies]
poly1305-nostd = "0.1"
use poly1305_nostd::Poly1305;
let key = [0u8; 32]; // Must be unique per message
let message = b"Hello, world!";
let tag = Poly1305::mac(&key, message);
assert_eq!(tag.len(), 16);
use poly1305_nostd::Poly1305;
let key = [0u8; 32];
let mut poly = Poly1305::new(&key);
poly.update(b"Hello, ");
poly.update(b"world!");
let tag = poly.finalize();
Poly1305 is a one-time authenticator designed by Daniel J. Bernstein:
a = ((a + block) * r) mod (2^130 - 5)tag = (a + s) mod 2^1282^130 - 5On modern x86_64 CPUs:
(Performance varies by target; bare-metal may differ)
Tested on:
x86_64-unknown-none (bare-metal)x86_64-unknown-linux-gnu (std)Run the test suite:
cargo test
Includes RFC 8439 test vectors.
Licensed under Apache License 2.0.
Contributions welcome! This crate was extracted from a bare-metal OS project to help the Rust embedded and bare-metal community overcome LLVM SIMD limitations.