public class Passwords extends Object
Modifier and Type | Method and Description |
---|---|
static String |
hashPassword(String password)
the method calculates a hash with a generated salt for the given password
|
static boolean |
isExpectedPassword(String password,
String expectedHash)
the method checks if the given password matches the calculated hash
|
static boolean |
isExpectedPassword(String password,
String salt,
String hash)
the method checks if the given password matches the calculated hash
|
static void |
main(String[] args) |
public static String hashPassword(String password)
password
- public static boolean isExpectedPassword(String password, String expectedHash)
password
- expectedHash
- public static boolean isExpectedPassword(String password, String salt, String hash)
password
- salt
- hash
- the hash generated using the saltpublic static void main(String[] args)
Copyright © 2017. All rights reserved.