authKey returns the bcrypt hash + SHA1 digest of the password.
(hash []byte, password []byte)
| 30 | |
| 31 | // authKey returns the bcrypt hash + SHA1 digest of the password. |
| 32 | func authKey(hash []byte, password []byte) (key string) { |
| 33 | s := sha1.New() |
| 34 | s.Write(password) |
| 35 | digest := string(s.Sum(nil)) |
| 36 | key = digest + string(hash) |
| 37 | return key |
| 38 | } |
| 39 | |
| 40 | // compareHashAndPassword is an optimized wrapper around bcrypt.CompareHashAndPassword that |
| 41 | // caches successful results in memory to avoid the _very_ high overhead of calling bcrypt. |