Use BCrypt for derivation.
Use BCrypt for derivation.
Default parameters: cost = 12.
Note that work factor for bcrypt increases at 2^{cost}.
Use PBKDF2 for derivation.
Use PBKDF2 for derivation.
Default parameters: rounds = 65536 (2 ^ 16), salt length: 16 bytes, key size: 256 bits, digest = SHA1.
Note: That SHA256 and SHA512 can only be used with JDK8+ or with a custom JCE provider that supports this algorithm such as BSAFE or IAIK. Excepting this limitations SHA2 algorithms would normally be preferred.
Use SCrypt for derivation.
Use SCrypt for derivation.
Default parameters: N = 65536 (2 ^ 16). r = 8, p = 1
Build passwords structure using default (overridable) algorithm parameters.
Each algorithm has sensible defaults, but consider careful research and potentailly doing computation tests on your hardware to make the most appropriate choice (read as: set as high as you can before the performance becomes crippling).
In terms of algorithms selection there are a few factors that should be considered:
Availability of algorithm
Of the provided algorithms scrypt, bcrypt and PBKDF2 with HMAC-SHA1 are always available. PBKDF2 with HMAC-SHA256 or HMAC-SHA512 are only available on JDK8 or with a custom JCE provider such as IAIK or BSAFE.
The fact that PBKDF2 is stuck with HMAC-SHA1 by default potentially makes it less desirable.
Trust of underlying implementaion
Trust of underlying implementations is difficult, but all implementations are open source and can be audited:
There is some ongoing effort to complete a review of the scrypt and bcrypt implementations.
Work factors
Work factors of underlying algorithm is also difficult to classify because of the number of variables invloved (CPU, Memory, etc...).
Reading is possibly the only solution, but it is worth noting that scrypt was specifically designed to be more difficult to run with modern computing constraints (or lack there of) on FGPAs and alike. Scrypt is build on top of PBKDF2 with HMAC-SHA256. The [scrypt paper](http://www.tarsnap.com/scrypt/scrypt.pdf) has some insight into this.
In terms of choosing appropriate factors, measurement is often the best approach. As a general rule you would want to tune the algorithm so password generation takes ~100ms. There are some factors listed in the OWASP password cheatsheet which is a pretty good source of information
Validation requirements
Validation requirements are easier. You will know if you have them. PBKDF2 is the only NIST approved algorithm.