Created
October 21, 2020 06:27
-
-
Save leucos/4cd491442080ad2bc44558ef5d1cea56 to your computer and use it in GitHub Desktop.
Get entropy for password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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