X-Git-Url: http://www.git.cypherpunks.ru/?p=balloon.git;a=blobdiff_plain;f=balloon.go;h=179d570f22a04b2be8e68541909138956a6aa580;hp=f0d8390f75790687e55dc2a24d36a8768668c876;hb=de50ac56abf0f332ecd7e5a812f07c3a02b0e42a;hpb=9a1a4ae452c536a3523b31269697c85479465b87 diff --git a/balloon.go b/balloon.go index f0d8390..179d570 100644 --- a/balloon.go +++ b/balloon.go @@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. +the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -141,9 +140,10 @@ func H(hasher func() hash.Hash, passwd, salt []byte, sCost, tCost int, jobs 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()