Q: What is a high entropy string?
A high entropy string is a string that is close to random noise, with little to no structure. API keys, passwords, and hashed data are often high entropy strings.
Q: Why is this useful?
By being able to detect high entropy strings, you can automatically flag them, or redact them, preventing secrets from being leaked, for example by being committed to a public repository or logged to a file or service.
npm i detect-high-entropy-strings
const DHES = require("detect-high-entropy-strings");
const detector = new DHES();
const result = detector.isHighEntropyString("051cd83bef009e738bddbdbaac373d20");
if (result) {
console.log("This is a high entropy string!");
} else {
console.log("This is not a high entropy string.");
}
The project is licensed under the MIT license.
The icon at the top of this file is provided by pngrepo.com and is licensed under CC0.