M
M
Mikhail2015-01-29 11:52:57
Java
Mikhail, 2015-01-29 11:52:57

Problem with Java code processing?

Dear friends! Please help me with this code snippet. Complains about NoSuchAlgorithmException and UnsupportedEncodingException
private void func198i (){
String x0 = this.mc.session.sessionId;
x0 = getHash(x0+"protect");
this.mc.session.sessionId = x0;
}
public static String getHash(String str){
MessageDigest m;
try {
m = MessageDigest.getInstance("MD5");
m.reset();
try {
m.update(str.getBytes("utf-8"));
String s2 = new BigInteger(1,m.digest()).toString(16);
while(s2.length() < 32 ){
s2 = "0"+s2;
}
return s2;
} catch (UnsupportedEncodingException e) {
return e.toString();
}
} catch (NoSuchAlgorithmException e) {
return e.toString();
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Seryozha Pukhov, 2015-01-29
@kursoriks

The Oracle doc describes this exception as follows:
This exception is thrown when a particular cryptographic algorithm is requested but is not available in the environment.
Accordingly, it looks like your system does not have this encryption algorithm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question