Android MD5 encryption is the same as j2se, because Android supports Java. Security. messagedigest. Actually, it is exactly the same as the j2se platform.
Algorithm signature:
String getmd5 (string Val) throws nosuchalgorithmexception
Enter a string (the text to be encrypted) to obtain an encrypted output string (the encrypted text)
Package COM. tencent. utils; import Java. security. messagedigest; import Java. security. nosuchalgorithmexception;/*** provides the getmd5 (string) Method * @ author randyjia **/public class MD5 {public static string getmd5 (string Val) throws nosuchalgorithmexception {messagedigest MD5 = messagedigest. getinstance ("MD5"); md5.update (Val. getbytes (); byte [] M = md5.digest (); // encrypted return getstring (m);} Private Static string getstring (byte [] B) {stringbuffer sb = new stringbuffer (); For (INT I = 0; I <B. length; I ++) {sb. append (B [I]);} return sb. tostring ();}}
End