xs/vendor/github.com/jameskeane/bcrypt
Russ Magee caac02a77b 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string)
2/2 Added vendor/ dir to lock down dependent pkg versions.
The author of git.schwanenlied.me/yawning/{chacha20,newhope,kyber}.git has copied
their repos to gitlab.com/yawning/ but some imports of chacha20 from newhope still
inconsistently refer to git.schwanenlied.me/, breaking build.
Licenses for chacha20 also changed from CC0 to AGPL, which may or may not be an
issue. Until the two aforementioned issues are resolved, locking to last-good
versions is probably the best way forward for now.

To build with vendored deps, use make VENDOR=1 clean all
2020-01-29 13:55:38 -08:00
..
.gitignore 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string) 2020-01-29 13:55:38 -08:00
LICENSE 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string) 2020-01-29 13:55:38 -08:00
README 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string) 2020-01-29 13:55:38 -08:00
bcrypt.go 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string) 2020-01-29 13:55:38 -08:00
cipher.go 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string) 2020-01-29 13:55:38 -08:00

README

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