mirror of
https://github.com/decke/smtprelay.git
synced 2025-12-25 07:43:06 -07:00
Merge pull request #3 from nwillems/add-hasher-tool
Add helper to do hashing
This commit is contained in:
6
cmd/README.md
Normal file
6
cmd/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
To run the hasher, do like this
|
||||
|
||||
```bash
|
||||
$ go run hasher.go hunter2
|
||||
```
|
||||
18
cmd/hasher.go
Normal file
18
cmd/hasher.go
Normal 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), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
fmt.Println("Error generating hash: %s", err)
|
||||
}
|
||||
fmt.Println(string(hash))
|
||||
}
|
||||
Reference in New Issue
Block a user