balloon.go | 7 ++++--- diff --git a/balloon.go b/balloon.go index b8020d427f4a558bc07372279dc0fabf9b4f253e3770e67cd062833b5dcea6f7..59c5d751b38a236453e69aec8eb463c938c7221be18b82e1198306a9e27ec5af 100644 --- a/balloon.go +++ b/balloon.go @@ -141,9 +141,10 @@ var i int results := make(chan []byte) for ; i < jobs; i++ { go func(i int) { - saltBuf := make([]byte, 8) - binary.BigEndian.PutUint64(saltBuf, uint64(i)) - results <- B(hasher(), passwd, append(salt, saltBuf...), sCost, tCost) + saltBuf := make([]byte, len(salt)+8) + copy(saltBuf, salt) + binary.BigEndian.PutUint64(saltBuf[len(salt):], uint64(i)) + results <- B(hasher(), passwd, saltBuf, uint64(sCost), uint64(tCost)) }(i) } h := hasher()