Answer the question
In order to leave comments, you need to log in
What does this Java code do?
I was provided with this code from the site in order to check for a correctly installed Java JDK, but this code seems a little dangerous to me.
THE CODE:
import java.security.MessageDigest;
public class Test {
public static void main(String[] args) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest("Hello, JM.".getBytes("UTF-8"));
for (byte b : digest) {
System.out.printf("%02x", b);
}
}
}
Answer the question
In order to leave comments, you need to log in
digest()
Completes the hash computation by performing final operations such as padding. The digest is reset after this call is made.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question