Package Components
Class Encrypter
- java.lang.Object
-
- Components.Encrypter
-
public final class Encrypter extends java.lang.Object
Encrypter class for encrypting password using hash and salt
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Encrypter()
Private constructor to hinder creation of utility class
-
Method Summary
Modifier and Type Method Description private static byte[]
buildBytes(java.lang.String hex)
Hex-to-byte converterprivate static java.lang.String
buildHexString(byte[] bytes)
Byte-to-Hex converterstatic java.lang.String
encrypt(java.lang.String password, java.lang.String saltest)
Encryption used for the password, method is used for both making and verifying an encrypted password.static java.lang.String
getHash(java.lang.String s)
Used to get the hash string from the encrypt functionstatic java.lang.String
getSalt(java.lang.String s)
Used to get the salt string from the encrypt function
-
-
-
Method Detail
-
encrypt
public static java.lang.String encrypt(java.lang.String password, java.lang.String saltest)
Encryption used for the password, method is used for both making and verifying an encrypted password.- Parameters:
password
- String password that the user har enteredsaltest
- String hex values for the salt- Returns:
- String combination of both "hash|salt", uses splitters to get either
-
buildHexString
private static java.lang.String buildHexString(byte[] bytes)
Byte-to-Hex converter- Parameters:
bytes
- is an array of byte- Returns:
- String bytes in hex
-
buildBytes
private static byte[] buildBytes(java.lang.String hex)
Hex-to-byte converter- Parameters:
hex
- input to get an byte array- Returns:
- byte[] converted from hex
-
getHash
public static java.lang.String getHash(java.lang.String s)
Used to get the hash string from the encrypt function- Parameters:
s
- the output from encrypt- Returns:
- String hash
-
getSalt
public static java.lang.String getSalt(java.lang.String s)
Used to get the salt string from the encrypt function- Parameters:
s
- the output from encrypt- Returns:
- String salt
-
-