Add helper to do hashing

This commit is contained in:
Nicolai Willems
2020-05-24 20:55:11 +02:00
parent 999ccab778
commit 36673ae3f0
2 changed files with 24 additions and 0 deletions

18
cmd/hasher.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"golang.org/x/crypto/bcrypt"
)
func main() {
password := os.Args[1]
hash, err := bcrypt.GenerateFromPassword([]byte(password), 12)
if err != nil {
fmt.Println("Error generating hash: %s", err)
}
fmt.Println(string(hash))
}