import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.lang.Thread; public class md5 extends Thread{ public String str; public String md5s(String plainText) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) i += 256; if (i < 16) buf.append("0"); buf.append(Integer.toHexString(i)); } str = buf.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return str; } public static void main(String agrs[]) { md5 md51 = new md5(); md51.start(); } public void run(){ md5 m = new md5(); for(int i=799999999;i>700000000;i--){ if(m.md5s(m.md5s(m.md5s(i+"").toUpperCase()+i+"").toUpperCase()+i+"").toUpperCase().equals("5F35606056102557CF35554FA181562D")){ System.out.println("Value of i="+i+"================"+m.md5s(i+"")); } } } }
时间: 2024-10-30 12:31:08