I'm using KeyDerivation.Pbkdf2 to generate password hashes, and I was wondering what the general advice is regarding the salt length compared to the overall hash length that Pbkdf2 outputs.
In the implementation below, I'm using HMACSHA512, and assume that the salt is 512 bits, and that the hashBitLength is also 512 bits.
KeyDerivation.Pbkdf2(password, salt, KeyDerivationPrf.HMACSHA512, iterationCount, hashBitLength / 8);
I've seen an example which uses HMACSHA256, but it has the salt set to 128 bits and the overall hash bit length to 256. Why would this approach be taken?
I've read that 512 bits is probably overkill, but in terms of storage, it doesn't concern me (I'm not sure how performance is impacted though, I haven't measured that).
Should the salt be the same length as the overall resulting hash. Should it be half? Or should it be anything above a certain threshold and below the overall length?
My gut says the way I'm doing it is correct (Aside from perhaps the 512 bit) as I suspect I'm getting maximum entropy, but I'm no cryptographer.
Could someone please clarify this for me?