package generic

import "github.com/DefangLabs/secret-detector/pkg/detectors/generic"

Index

Constants

const (
	HighEntropyStringDetectorName = "high_entropy_string"
)
const (
	URLPasswordDetectorName = "url_password"
)

Functions

func CalcShannonEntropy

func CalcShannonEntropy(s string) float64

CalcShannonEntropy calculates how random a string is. Minimal possible level is 0, which means that all characters in the string are similar. Maximal possible level is log2(len(s)), which means that all characters in the string are different from one another.

Formula: sum( frequency(char) * log2(frequency(char)) ) See more https://en.wikipedia.org/wiki/Entropy_(information_theory)

func NewHighEntropyStringDetector

func NewHighEntropyStringDetector(config ...string) secrets.Detector

func NewURLPasswordDetector

func NewURLPasswordDetector(config ...string) secrets.Detector

Source Files

high_entropy_string_detector.go url_password_detector.go

Version
v0.0.0-20250403165618-22662109213e (latest)
Published
Apr 3, 2025
Platform
js/wasm
Imports
7 packages
Last checked
9 hours ago

Tools for package owners.