aboutsummaryrefslogtreecommitdiff
path: root/bhash
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-04-14 10:03:17 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-04-14 10:03:17 +0200
commit43ed58317531c5f23e7a0bb774e176dc66f47694 (patch)
tree85168e87e53bbd8cec186b0ec7de63b379d39dde /bhash
parent77de5055b670b6b56d0dc091b4f90d626f76bfb6 (diff)
...
Diffstat (limited to 'bhash')
-rw-r--r--bhash/bhash.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/bhash/bhash.go b/bhash/bhash.go
index 443a862..422ab76 100644
--- a/bhash/bhash.go
+++ b/bhash/bhash.go
@@ -45,11 +45,17 @@ func Pbkdf(pass, salt []byte, iter, keyLen int) []byte {
h.Write(pass)
sha2pass := h.Sum(nil)
- out := make([]byte, 32) // XXX
+ out := make([]byte, 4*blowfish.BlockSize) // XXX
for count := 1; keyLen > 0; count++ {
- countSalt := []byte{byte(count >> 24), byte(count >> 16), byte(count >> 8), byte(count)}
- // first round salt is salt
+ countSalt := []byte{
+ byte(count >> 24),
+ byte(count >> 16),
+ byte(count >> 8),
+ byte(count),
+ }
+
+ // first round, salt is salt
h.Reset()
h.Write(salt)
h.Write(countSalt)
@@ -63,13 +69,15 @@ func Pbkdf(pass, salt []byte, iter, keyLen int) []byte {
h.Write(tmp)
sha2salt = h.Sum(nil)
tmp = Hash(sha2pass, sha2salt)
- log.Println(len(tmp), len(out))
for i := range out {
out[i] ^= tmp[i]
}
log.Println(out)
}
+ // pbkdf2 deviation: output the key material non-linearly
+ // TODO
+
keyLen-- // XXX
}