public static String createHash(char[] password) throws NoSuchAlgorithmException, InvalidKeySpecException {
  SecureRandom random=new SecureRandom();
  byte[] salt=new byte[SALT_BYTE_SIZE];
  random.nextBytes(salt);
  byte[] hash=pbkdf2(password,salt,PBKDF2_ITERATIONS,HASH_BYTE_SIZE);
  return PBKDF2_ITERATIONS + ":" + toHex(salt)+ ":"+ toHex(hash);
}

public static String createHash ( char [ ] password ) throws NoSuchAlgorithmException , InvalidKeySpecException { SecureRandom random = new SecureRandom ( ) ; byte [ ] salt = new byte [ SALT_BYTE_SIZE ] ; random . nextBytes ( salt ) ; byte [ ] hash = pbkdf2 ( password , salt , PBKDF2_ITERATIONS , HASH_BYTE_SIZE ) ; return PBKDF2_ITERATIONS + ":" + toHex ( salt ) + ":" + toHex ( hash ) ; }
returns a salted pbkdf2 hash of the password .
