diff --git a/bscrypt.cpp b/bscrypt.cpp index 3e8f201..957484f 100644 --- a/bscrypt.cpp +++ b/bscrypt.cpp @@ -562,12 +562,13 @@ int bscrypt_kdf(void *output, size_t outputSize, const void *password, size_t pa // Step 3: output = kdf(work, seed) uint64_t i = 1; + uint64_t workSeed0 = workSeed[0]; while (outputSize > 64) { blake2b_nativeIn(output, 64, workSeed, 16 * sizeof(uint64_t)); output = ((uint8_t*) output) + 64; outputSize -= 64; - workSeed[0] ^= i; + workSeed[0] = workSeed0 ^ i; i++; } if (outputSize != 0)