PasswordHash4j/src/cz/GravelCZLP/PasswordHash/PasswordHashv2.java
private static byte[] pbkdf2(char[] password, byte[] salt, int iterations) {
		KeySpec spec = new PBEKeySpec(password, salt, iterations, SIZE);
		try {
			SecretKeyFactory factory = SecretKeyFactory.getInstance(ALGORITHM);
			return factory.generateSecret(spec).getEncoded();
		} catch (InvalidKeySpecException e) {
			e.printStackTrace();
			System.out.println("Invalid SecretKeyFactory: " + e.getMessage());
		} catch (NoSuchAlgorithmException e1) {
			e1.printStackTrace();
			System.out.println("No such algorithm: " + ALGORITHM + " : " + e1.getMessage());
		}
		return new byte[1];
	}
/**
	 * Hashes Password
	 * @param password password to hash
	 * @param salt generated random salt
	 * @param iterations how many iterations to use
	 * @return hashed version of password
	 */
Hashes Password
@param password password to hash
@param salt generated random salt
@param iterations how many iterations to use
@return hashed version of password
Hashes Password @param password password to hash @param salt generated random salt @param iterations how many iterations to use @return hashed version of password
private static byte[] pbkdf2(char[] password, byte[] salt, int iterations) {
		KeySpec spec = new PBEKeySpec(password, salt, iterations, SIZE);
		try {
			SecretKeyFactory factory = SecretKeyFactory.getInstance(ALGORITHM);
			return factory.generateSecret(spec).getEncoded();
		} catch (InvalidKeySpecException e) {
			e.printStackTrace();
			System.out.println("Invalid SecretKeyFactory: " + e.getMessage());
		} catch (NoSuchAlgorithmException e1) {
			e1.printStackTrace();
			System.out.println("No such algorithm: " + ALGORITHM + " : " + e1.getMessage());
		}
		return new byte[1];
	}
private static byte [ ] pbkdf2 ( char [ ] password , byte [ ] salt , int iterations ) { KeySpec spec = new PBEKeySpec ( password , salt , iterations , SIZE ) ; try { SecretKeyFactory factory = SecretKeyFactory . getInstance ( ALGORITHM ) ; return factory . generateSecret ( spec ) . getEncoded ( ) ; } catch ( InvalidKeySpecException e ) { e . printStackTrace ( ) ; System . out . println ( "Invalid SecretKeyFactory: " + e . getMessage ( ) ) ; } catch ( NoSuchAlgorithmException e1 ) { e1 . printStackTrace ( ) ; System . out . println ( "No such algorithm: " + ALGORITHM + " : " + e1 . getMessage ( ) ) ; } return new byte [ 1 ] ; }
Hashes Password
 @param password password to hash
 @param salt generated random salt
 @param iterations how many iterations to use
 @return hashed version of password
Hashes Password @param password password to hash @param salt generated random salt @param iterations how many iterations to use @return hashed version of password