/** * Shannon entropy calculation for detecting high-entropy strings * that may be secrets (API keys, tokens, passwords, etc.) * * Entropy measures the randomness/unpredictability of a string. * Higher entropy = more random = more likely to be a secret. */ /** * Minimum string length to consider for entropy analysis. * Shorter strings don't have enough data for meaningful entropy calculation. */ export declare const MIN_LENGTH_FOR_ENTROPY = 16; /** * High entropy threshold (bits per character). * Typical thresholds: * - English text: ~1.0-1.5 bits/char * - Base64 encoded: ~5.5-6.0 bits/char * - Random alphanumeric: ~5.0-5.5 bits/char * - Pure random bytes: ~8.0 bits/char (max) * * We use 4.5 as a threshold to catch most secrets while avoiding * too many false positives on normal text. */ export declare const HIGH_ENTROPY_THRESHOLD = 4.5; /** * Strict entropy threshold for --strict mode. * Lower threshold means more things get flagged. */ export declare const STRICT_ENTROPY_THRESHOLD = 4; /** * Calculate Shannon entropy of a string. * * Shannon entropy measures the average number of bits needed to encode * each character based on its frequency distribution. * * @param str - The string to analyze * @returns Entropy in bits per character */ export declare const calculateEntropy: (str: string) => number; /** * Check if a string has characteristics of a secret based on entropy * and other heuristics. * * @param value - The string to check * @param strictMode - If true, use stricter (lower) threshold * @returns True if the string looks like a potential secret */ export declare const isPossibleSecretByEntropy: (value: string, strictMode?: boolean) => boolean; /** * Get entropy level description for human-readable output */ export declare const getEntropyLevel: (entropy: number) => string;