Package com.webfirmframework.wffweb.util
Class HashUtil
java.lang.Object
com.webfirmframework.wffweb.util.HashUtil
- Since:
- 3.0.1
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
base64FromUtf8Bytes
(byte[] bytes) static String
hashInBase64
(String s, String algo) static String
hashSHA256
(String s) static String
hashSHA384
(String s) static String
hashSHA512
(String s)
-
Field Details
-
SHA_512
- See Also:
-
SHA_384
- See Also:
-
SHA_256
- See Also:
-
-
Method Details
-
hashSHA256
- Parameters:
s
-- Returns:
- the SHA-256 hash of the given string in base64 encoding.
- Throws:
NoSuchAlgorithmException
-
hashSHA384
- Parameters:
s
-- Returns:
- the SHA-384 hash of the given string in base64 encoding.
- Throws:
NoSuchAlgorithmException
-
hashSHA512
- Parameters:
s
-- Returns:
- the SHA-512 hash of the given string in base64 encoding.
- Throws:
NoSuchAlgorithmException
-
base64FromUtf8Bytes
- Parameters:
bytes
-- Returns:
- the base64 string from the given utf-8 bytes. If the returned base64 string is converted to bytes it will be utf-8 encoded.
- Since:
- 3.0.1
-
hashInBase64
- Parameters:
s
-algo
- eg: SHA-256, SHA-384 or SHA-512- Returns:
- the hash of the given string with the given algo.
- Throws:
NoSuchAlgorithmException
-