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

Variables

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

A valid password is impossible with the given constraints.

Functions

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.

Source Files

entropy.go

Version
v2.0.2 (latest)
Published
Oct 5, 2021
Platform
linux/amd64
Imports
7 packages
Last checked
2 weeks ago

Tools for package owners.