Class MessageDigestPasswordEncoder
java.lang.Object
net.bull.javamelody.internal.common.MessageDigestPasswordEncoder
Encode (hash) passwords to prevent writing them as clear texts.
The hash algorithm SHA-256 with a salt is theoretically not reversible in human time.
- Author:
- Emeric Vernat
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencodePassword(String password) Encode (hash) a password.static voidTo be used from commande line to hash password(s) using SHA-256
-
Constructor Details
-
MessageDigestPasswordEncoder
Constructor.- Parameters:
algorithm- String likeSHA-256(recommended),SHA-512,SHA-384or (not recommended)SHA-224,SHA-1,MD5or more in Java 11
-
-
Method Details
-
main
To be used from commande line to hash password(s) using SHA-256- Parameters:
args- String[]- Throws:
NoSuchAlgorithmException- Not possible for SHA-256
-
encodePassword
Encode (hash) a password.- Parameters:
password- String likepassword- Returns:
- String like
{SHA-256}c33d66fe65ffcca1f2260e6982dbf0c614b6ea3ddfdb37d6142fbec0feca5245 - Throws:
NoSuchAlgorithmException- In case algorithm in constructor is not supported
-