Http://md5.tellyou.top/default.html
public class Md5andkl {
MD5 overweight. 32 Guests
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 < 16)
Hexvalue.append ("0");
Hexvalue.append (Integer.tohexstring (Val));
}
return hexvalue.tostring ();
}
Reversible encryption 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;
}
Decryption after encryption
public static string JM (String inStr) {
Char[] A = Instr.tochararray ();
for (int i = 0; i < a.length; i++) {
A[i] = (char) (a[i] ^ ' t ');
}
String k = new String (a);
return k;
}
Test the main function
public static void Main (String args[]) {
string s = new String ("123123");
4297f44b13955235245b2497399d7a93
System.out.println ("Original:" + s);
System.out.println ("After MD5:" + MD5 (s));
System.out.println ("MD5 after re-encryption:" + KL (MD5 (s));
System.out.println ("Decrypted for MD5:" + JM (KL (MD5 (s)));
}
}
MD5 Decryption and encryption algorithm