@Test public void testGenSaltedPassword() throws Exception { String password = PasswordUtils.genPassword("password", "salt".getBytes(), "PBKDF2WithHmacSHA1"); assertEquals("a2c2646186828474b754591a547c18f132d88d744c152655a470161a1a052135$73616c74", password); }
public static String genPassword(String password, String hashMethod) throws Exception { byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(SALT_LEN); return genPassword(password, salt, hashMethod); }
PasswordUtils { public static String genPassword(String password, String hashMethod) throws Exception { byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(SALT_LEN); return genPassword(password, salt, hashMethod); } }
PasswordUtils { public static String genPassword(String password, String hashMethod) throws Exception { byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(SALT_LEN); return genPassword(password, salt, hashMethod); }  }
PasswordUtils { public static String genPassword(String password, String hashMethod) throws Exception { byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(SALT_LEN); return genPassword(password, salt, hashMethod); }  static String genPassword(String password, String hashMethod); static String genPassword(String password, byte[] salt, String hashMethod); static String hash(String password, byte[] salt); static void validate(String password, String passwordInDB, String hashMethod); static boolean isHashMethodSupported(String hashMethod); }
PasswordUtils { public static String genPassword(String password, String hashMethod) throws Exception { byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(SALT_LEN); return genPassword(password, salt, hashMethod); }  static String genPassword(String password, String hashMethod); static String genPassword(String password, byte[] salt, String hashMethod); static String hash(String password, byte[] salt); static void validate(String password, String passwordInDB, String hashMethod); static boolean isHashMethodSupported(String hashMethod); static final String HASH_METHOD_PLANTEXT; static final String HASH_METHOD_PBKDF2; }