# Debug bcrypt iterations with a static salt [closed]

I want to debug bcrypt rounds with a static salt using this python lib

import bcrypt
salt = bcrypt.gensalt(14)
foo_1_round = bcrypt.kdf(password, salt, desired_key_bytes=10, rounds=1)
foo_2_rounds_manually = bcrypt.kdf(foo_1_round, salt, desired_key_bytes=10, rounds=1)

foo_2_rounds = bcrypt.kdf(password, salt, desired_key_bytes=10, rounds=2)


I expected to see equal foo_2_rounds and foo_2_rounds_manually

• Please note that crossposting is not allowed. Sep 24 at 19:48

The cost factor of password hashing algorithms is often called “iterations”, because for classic algorithms it's an iteration count. But for modern algorithms, the cost factor(s) often have more impact than a loop count. For bcrypt, the cost factor is used for the Blowfish key setup, which has a loop with $$2^{\textrm{cost}}$$ iterations. The hash is not the output of this loop: the output of this loop is a key and the hash is the encryption of a fixed text with this key. With a higher cost factor, the key is different and so the final result is completely unrelated.