Package sk.iway.iwcm.users.crypto
Class Sha512
java.lang.Object
sk.iway.iwcm.users.crypto.Sha512
- All Implemented Interfaces:
PasswordSecurityAlgorithm
Hashovanie hesiel pomocou Sha-512 algoritmu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateHash(String password, String salt) Generates a hash combining password and a salt using concatenation.Generates a random HEX string chars = [0-9a-f]{16}, lowercase onlybooleanisPasswordCorrect(String password, String salt, String hash)
-
Constructor Details
-
Sha512
public Sha512()
-
-
Method Details
-
generateSalt
Generates a random HEX string chars = [0-9a-f]{16}, lowercase only- Specified by:
generateSaltin interfacePasswordSecurityAlgorithm- Returns:
Stringrandom hex string
-
calculateHash
Generates a hash combining password and a salt using concatenation. Algorithm employed: SHA-512- Specified by:
calculateHashin interfacePasswordSecurityAlgorithm- Parameters:
password- any Stringsalt- Generated by generateSalt, must match ^[0-9a-f]{16}$, otherwise rejected- Returns:
- [0-9a-f]{128} String
-
isPasswordCorrect
- Specified by:
isPasswordCorrectin interfacePasswordSecurityAlgorithm
-