package entropy

import "git.sr.ht/~seirdy/moac/v2/entropy"

Package entropy provides a means to compute entropy of a given random string by analyzing both the charsets used and its length.

Index

Package Files

entropy.go

Variables

var (
    ErrPasswordInvalid = errors.New("invalid password")
)

A valid password is impossible with the given constraints.

func Entropy

func Entropy(password string) float64

Entropy computes the number of entropy bits in the given password, assumingly it was randomly generated.

func FromCharsets

func FromCharsets(charsetsUsed charsets.CharsetCollection, length int) (float64, error)

FromCharsets computes the number of entropy bits in a string with the given length that utilizes at least one character from each of the given charsets. It does not perform any subsetting/de-duplication upon the given charsets; they are just used as-is.

Package entropy imports 7 packages (graph).

Version v2.0.2 (latest) | Published Oct 5, 2021 | Platform: linux/amd64 | Updated 1 month ago

.
Tools for package owners.