Skip to content

Instantly share code, notes, and snippets.

@leucos
Created October 21, 2020 06:27
Show Gist options
  • Save leucos/4cd491442080ad2bc44558ef5d1cea56 to your computer and use it in GitHub Desktop.
Save leucos/4cd491442080ad2bc44558ef5d1cea56 to your computer and use it in GitHub Desktop.
Get entropy for password
package main
import (
"fmt"
"syscall"
"golang.org/x/crypto/ssh/terminal"
passwordvalidator "github.com/lane-c-wagner/go-password-validator"
)
func main() {
fmt.Print("Enter Password: ")
bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
panic(err)
}
password := string(bytePassword)
fmt.Println(passwordvalidator.GetEntropy(password))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment