When comparing passwords, there is always an issue of keeping them in memory. Instead, the moment a password is introduced, i’d like to replace it with its md5 snapshot (or any other hash producing function)
Assuming you have a Key Value pair String password = "Secret";, what is the simplest way to scramble “secret” to something unique?
Use a MessageDigest. Something like this:
Also, watch out of the NoSuchAlgorithmException that can be thrown by the getInstance method if the MD5 algorithm is somehow not available.