Simple Demo:java code import java.security.*; Import java.security.spec.*; Class MD5_test { public final static &NBSP;STRING&NBSP;MD5 (String s) { char hexDigits[] = { ' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' a ', &NB Sp ' B ', ' C ', ' d ', ' e ', ' F ' }; try { & Nbsp;byte [] strtemp = s.getbytes (); messagedigest mdtemp = messagedigest.getinstance ("MD5"); mdtemp.update (strTemp); byte [] md = mdtemp.digest (); int j = md.length; char str[] = new Char [j * 2]; int k = 0;   ; for (int i = 0; i < j; i++) { byte byte0 = md[i]; str[k++] = Hexdigits[byte0 >>> 4 & 0xf]; str[k++] &NBSP;=&NBSP;HEXDIGITS[BYTE0&NBSP;&&NBSP;0XF]; } return New string (str); } catch (exception e) { return NULL; } } & nbsp public static void main (String[] args) { // md5_ Test aa = new md5_test (); system.out.print (MD5_test. MD5 ("B")); } }
Import java.security.*;
Import java.security.spec.*;
Class Md5_test {public
final static string MD5 (string s) {
char hexdigits[] = {' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ' , ' 7 ', ' 8 ', ' 9 ',
' a ', ' B ', ' C ', ' d ', ' e ', ' f '};
try {
byte[] strtemp = S.getbytes ();
MessageDigest mdtemp = messagedigest.getinstance ("MD5");
Mdtemp.update (strtemp);
byte[] MD = Mdtemp.digest ();
int j = md.length;
Char str[] = new CHAR[J * 2];
int k = 0;
for (int i = 0; i < J; i++) {
byte byte0 = md[i];
str[k++] = hexdigits[byte0 >>> 4 & 0xf];
str[k++] = hexdigits[byte0 & 0xf];
}
return new String (str);
catch (Exception e) {return
null;
}
}
public static void Main (string[] args) {
//md5_test AA = new Md5_test ();
System.out.print (md5_test. MD5 ("B"));
}
Java Code Import java.security.MessageDigest; public class MD5andKL { &NBSP;//&NBSP;MD5 Overweight. 32-bit public static string md5 (STRING&NBSP;INSTR) { Messagedigest md5 = null; try { md5 = messagedigest.getinstance ("MD5"); } catch (Exception e) { system.out.println (e.tostring ()); E.printstacktrace (); return ""; } char [] chararray = instr.tochararray (); byte [] byteArray = new byte [chararray.length]; for (int i =& nbsp 0. i < chararray.length; i++) byteArray[i] = (byte) charArray[i]; byte [] md5bytes = md5.digest (ByteArray); Stringbuffer hexvalue = new stringbuffer (); for ( int i = 0; i < md5bytes.length; i++) { int val = ((int) md5bytes[i]) & 0xff; if & nbsp (val < ) hexvalue.append ("0"); hexvalue.append (Integer.tohexstring (val)); } Return hexvalue.tostring (); } // reversible encryption Algorithm public Static &NBSP;STRING&NBSP;KL (STRING&NBSP;INSTR) { // string s = new string (INSTR); char [] a = instr.tochararray (); for (int i = 0 i < a.length; i++) { a[i] = (char) (a[i] ^ ' t '); } string s = new string (a); return s; } // encryption after decryption public static &NBSP;STRING&NBSP;JM (STRING&NBSP;INSTR) { char [] a = instr.tochararray (); for (int i = 0 i < a.length; i++) { a[i] = (char) (a[i] ^ ' t '); } string k = new string (a); &Nbsp; return k; } // Test main function public static void main (string args[]) { string s = new string ("a"); system.out.println ("Original:" + s); system.out.println (after "MD5:" + md5 (s)); system.out.println (" MD5 after encryption: "&NBSP;+&NBSP;KL (MD5 (s)); system.out.println (" Decrypted to MD5: "&NBSP;+&NBSP;JM ( MD5 (s))); } }
Import Java.security.MessageDigest; public class Md5andkl {//MD5 overweight.
32-bit public static string MD5 (String inStr) {messagedigest MD5 = NULL;
try {MD5 = messagedigest.getinstance ("MD5");
catch (Exception e) {System.out.println (e.tostring ());
E.printstacktrace ();
Return "";
} char[] Chararray = Instr.tochararray ();
byte[] ByteArray = new Byte[chararray.length];
for (int i = 0; i < chararray.length i++) bytearray[i] = (byte) chararray[i];
byte[] md5bytes = Md5.digest (ByteArray);
StringBuffer hexvalue = new StringBuffer ();
for (int i = 0; i < md5bytes.length i++) {int val = ((int) md5bytes[i]) & 0xFF;
if (Val <) hexvalue.append ("0");
Hexvalue.append (Integer.tohexstring (Val));
return hexvalue.tostring ();
}//Reversible cryptographic algorithm public static string KL (String inStr) {//String s = new String (INSTR);
Char[] A = Instr.tochararray ();
for (int i = 0; i < a.length i++) {A[i] = (char) (a[i] ^ ' t '); } STring s = new String (a);
return s;
Decrypt public static String JM (String inStr) {char[] a = Instr.tochararray () after encryption;
for (int i = 0; i < a.length i++) {A[i] = (char) (a[i] ^ ' t ');
String k = new String (a);
return k;
//test main function public static void main (string args[]) {string s = new String ("a");
System.out.println ("Original:" + s);
System.out.println ("MD5 after:" + MD5 (s));
System.out.println ("MD5 after encryption:" + KL (MD5 (s)));
System.out.println ("Decrypted as MD5:" + JM (KL (MD5 (s)));
}
}