-
Notifications
You must be signed in to change notification settings - Fork 24
A native bcrypt library for go (golang)
License
jameskeane/bcrypt
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Installation: goinstall github.com/jameskeane/bcrypt Example use: package main import ( "fmt" "github.com/jameskeane/bcrypt" ) var password = "WyWihatdyd?frub1" var bad_password = "just a wild guess" func main() { // generate a random salt with default rounds of complexity salt, _ := bcrypt.Salt() // generate a random salt with 10 rounds of complexity salt, _ = bcrypt.Salt(10) // hash and verify a password with random salt hash, _ := bcrypt.Hash(password) if bcrypt.Match(password, hash) { fmt.Println("They match") } // hash and verify a password with a static salt hash, _ = bcrypt.Hash(password, salt) if bcrypt.Match(password, hash) { fmt.Println("They match") } // verify a random password fails to match the hashed password if !bcrypt.Match(bad_password, hash) { fmt.Println("They don't match") } } Todo: grep 'TODO' * -r Notes: * This library is derived from jBcrypt by Damien Miller <djm@mindrot.org> * bcrypt_test.go is from ZooWar.com
About
A native bcrypt library for go (golang)
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published