feat(groq): CLI tool that computes Shannon entropy of a given string, helping assess password strength#3872
feat(groq): CLI tool that computes Shannon entropy of a given string, helping assess password strength#3872
Conversation
… helping assess password strength
🤖 Review by GROQ Agent✅ What's solid
🧪 Tests
🔒 Security
🧩 Docs / Developer Experience
🧱 Mocks / Fakes
Quick fix for the Unicode length bugReplace the byte‑length calculation with a character count: pub fn compute_entropy(s: &str) -> f64 {
let len = s.chars().count() as f64;
if len == 0.0 {
return 0.0;
}
let mut freq = std::collections::HashMap::new();
for ch in s.chars() {
*freq.entry(ch).or_insert(0usize) += 1;
}
let mut entropy = 0.0;
for count in freq.values() {
let p = (*count as f64) / len;
entropy -= p * p.log2();
}
entropy
}This change aligns the probability denominator with the actual number of characters processed, ensuring correct entropy values for all Unicode inputs. |
🤖 Review by GEMINI Agent✅ What's solid
🧪 Tests
🔒 Security
🧩 Docs/DX
🧱 Mocks/Fakes
|
🤖 Review by OPENROUTER AgentApocalypsAI Review: nightly-entropy-analyzer✅ What's solid
🧪 Tests
Actionable Feedback:
🔒 Security
Actionable Feedback:
🧩 Docs/DX
Actionable Feedback:
🧱 Mocks/Fakes
|
Implementation Summary
rust-utils/nightly-nightly-entropy-analyzer-3Rationale
Why safe to merge
rust-utils/nightly-nightly-entropy-analyzer-3.Test Plan
rust-utils/nightly-nightly-entropy-analyzer-3/README.mdrust-utils/nightly-nightly-entropy-analyzer-3/tests/Links
Mock Justification