aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bhash/bhash.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/bhash/bhash.go b/bhash/bhash.go
index ea3081c..f5fb395 100644
--- a/bhash/bhash.go
+++ b/bhash/bhash.go
@@ -1,3 +1,7 @@
+// Package bhash implements bcrypt_pbkdf key derivation function compatible to
+// OpenBSD implementation
+//
+// http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/bcrypt_pbkdf.c
package bhash
import (
@@ -15,6 +19,7 @@ var (
hashSize = words * 4
)
+// Hash computes bcrypt hash
func Hash(pass, salt []byte) []byte {
c, err := blowfish.NewSaltedCipher(pass, salt)
if err != nil {
@@ -41,6 +46,7 @@ func Hash(pass, salt []byte) []byte {
return buf.Bytes()
}
+// Pbkdf returns derivated key
func Pbkdf(pass, salt []byte, iter, keyLen int) []byte {
// collapse password
h := sha512.New()