Ver código fonte

Merge branch 'master' of github.com:decke/smtprelay

Bernhard Froehlich 5 anos atrás
pai
commit
ed1c3a9888
2 arquivos alterados com 24 adições e 0 exclusões
  1. 6 0
      cmd/README.md
  2. 18 0
      cmd/hasher.go

+ 6 - 0
cmd/README.md

@@ -0,0 +1,6 @@
+
+To run the hasher, do like this
+
+```bash
+$ go run hasher.go hunter2
+```

+ 18 - 0
cmd/hasher.go

@@ -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), bcrypt.DefaultCost)
+	if err != nil {
+		fmt.Println("Error generating hash: %s", err)
+	}
+	fmt.Println(string(hash))
+}