From 43ed58317531c5f23e7a0bb774e176dc66f47694 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 14 Apr 2017 10:03:17 +0200 Subject: ... --- bhash/bhash.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'bhash') 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 } -- cgit v1.2.3