entropy

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL