public
Created

PBKDF2 Java sample

  • Download Gist
gistfile1.java
Java
1 2 3 4 5
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec keyspec = new PBEKeySpec("password".toCharArray(), salt, 1000, 128);
Key key = factory.generateSecret(keyspec);
System.out.println(key.getClass().getName());
System.out.println(Arrays.toString(key.getEncoded()));

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.