public static String MD5 (String text, the String charset) {
Char [] who=new char [] {' 0 ', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
The MessageDigest msgDigest=null;
Try {
MsgDigest=MessageDigest. GetInstance (" MD5 ");
{} the catch (NoSuchAlgorithmException var6)
Throw new an IllegalStateException (" System doesn 't support the MD5 algorithm. ");
}
Try {
MsgDigest. Update (text. GetBytes (charset));
{} the catch (UnsupportedEncodingException var5)
Throw new an IllegalStateException (" System doesn 't support your EncodingException. ");
}
Byte [] bytes=msgDigest. Digest ();
Int l=bytes. The length;
Char [] out=new char [l & lt; & lt; 1);
int i=0;
For (int j=0; iThe out [j++]=who [(240 & amp; bytes [I]) & gt; & gt; & gt; 4);
The out [j++]=who [15 & amp; bytes [I]].
}
String md5Str=new String (out);
Return md5Str;
}
How do the above code into a PHP function, new look not to understand Java ~ thank you so much!