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()