Skip to content

Commit

Permalink
Output of KDF repeats
Browse files Browse the repository at this point in the history
For the blocks of 64 bytes of output, the first and forth blocks are the same (among others). Since it is "H(0 XOR data)" and "H(0 XOR 1 XOR 2 XOR 3 XOR data)"
  • Loading branch information
Sc00bz authored Mar 11, 2024
1 parent be1e52e commit fd91519
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bscrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd91519

Please sign in to comment.