public String createHash ( final char [ ] password ) { // Generate a random salt SecureRandom random = new SecureRandom ( ) ; byte [ ] salt = new byte [ saltBytes ] ; random . nextBytes ( salt ) ; // Hash the password byte [ ] hash = pbkdf2 ( password , salt , pbkdf2Iterations , hashBytes ) ; // format iterations:salt:hash return pbkdf2Iterations + ":" + StringUtil . toHexString ( salt ) + ":" + StringUtil . toHexString ( hash ) ; }
Returns a salted PBKDF2 hash of the password .