| Crates.io | cleansh-entropy |
| lib.rs | cleansh-entropy |
| version | 0.1.4 |
| created_at | 2025-12-20 00:47:54.057254+00 |
| updated_at | 2025-12-21 02:19:59.975053+00 |
| description | A no_std, zero-copy entropy detection engine for cleansh. |
| homepage | |
| repository | https://github.com/KarmaYama/cleansh-workspace |
| max_upload_size | |
| id | 1995818 |
| size | 37,071 |
cleansh-entropyA no_std, zero-copy entropy detection engine for high-performance secret scanning.
This crate provides the mathematical core for the CleanSH CLI's entropy detection capabilities. It uses Shannon entropy calculation combined with contextual keyword analysis to identify high-randomness strings that likely represent unstructured secrets (e.g., custom API keys, internal auth tokens) which regular expressions often miss.
key=, secret:) near high-entropy tokens._padding or ing), effectively eliminating "locator bleed."no_std Support: Designed to be embedded in environments without the standard library (requires alloc).The engine operates in three distinct phases to ensure surgical precision:
:, =).Add this to your Cargo.toml:
[dependencies]
cleansh-entropy = "0.1.4"
For identifying secrets in a larger text stream:
use cleansh_entropy::engine::EntropyEngine;
fn main() {
let text = b"auth_key=8x9#bF2!kL0Z@mN9_extra_padding";
// Initialize engine with a confidence threshold and window size
let engine = EntropyEngine::new(0.3, 16);
let matches = engine.scan(text);
for m in matches {
// Output will be surgically isolated to the high-entropy payload
println!("Found secret at {:?} with confidence {:.2}",
m.start..m.end, m.confidence);
}
}
This project is licensed under the MIT License or Apache License 2.0, at your option.
See LICENSE-MIT and LICENSE-APACHE for details.