Answer the question
In order to leave comments, you need to log in
How to encode a string in Java?
Hello, I have a problem. I want to encrypt a string in MD5 but don't know how). On the Internet, I rummaged through a bunch of sites and forums, and not one of them is explained in such a way that a beginner would understand. Can you give an example of code for MD5 encryption of the string String a = "habr"
Answer the question
In order to leave comments, you need to log in
Somehow you dug badly, google gives almost 12 million results for the query "java md5".
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(a.getBytes());
byte[] digest = md.digest();
Google badly, https://javadevblog.com/prymer-heshyrovanyya-md5-v...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question