Skip to content

Commit

Permalink
Merge pull request #3 from nwillems/add-hasher-tool
Browse files Browse the repository at this point in the history
Add helper to do hashing
  • Loading branch information
decke authored Jun 6, 2020
2 parents 880c3c3 + 076fd65 commit 6662fb7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

To run the hasher, do like this

```bash
$ go run hasher.go hunter2
```
18 changes: 18 additions & 0 deletions cmd/hasher.go
Original file line number Diff line number Diff line change
@@ -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))
}

0 comments on commit 6662fb7

Please sign in to comment.