Guest User

Untitled

a guest
Feb 3rd, 2012
9,094
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.*;
  2.  
  3. import java.security.MessageDigest;
  4.  
  5. public class pw_test {
  6.     public static void main(String[] args) {
  7.         // Original: String imei = System.getProperty("com.nokia.mid.imei");
  8.         String imei = "1234"; // your IMEI
  9.        
  10.         StringBuffer buffer = new StringBuffer(imei);
  11.         if(buffer.length() == 0)
  12.         {
  13.             System.exit(0);
  14.         }
  15.         buffer = buffer.reverse();
  16.         S40MD5Digest digest = new S40MD5Digest();
  17.         digest.reset();
  18.         try
  19.         {
  20.             digest.update(buffer.toString().getBytes("UTF-8"));
  21.         }
  22.         catch(Exception e)
  23.         {
  24.             e.printStackTrace();
  25.         }
  26.         byte bytes[] = digest.digest();
  27.         int bytesLength = bytes.length;
  28.         buffer = new StringBuffer();
  29.         for(int i = 0; i < bytesLength; i++)
  30.         {
  31.             int unsignedByte = bytes[i] + 128;
  32.             buffer.append(Integer.toString(unsignedByte, 16));
  33.         }
  34.  
  35.         System.out.println(buffer.toString());
  36.     }
  37. }
  38.  
  39. class S40MD5Digest
  40. //    implements com.whatsapp.api.util.MessageDigest
  41. {
  42.  
  43.     public S40MD5Digest()
  44.     {
  45.         try
  46.         {
  47.             _md5 = MessageDigest.getInstance("md5");
  48.         }
  49.         catch(Exception x) { }
  50.     }
  51.  
  52.     public void reset()
  53.     {
  54.         _md5.reset();
  55.     }
  56.  
  57.     public void update(byte bytes[])
  58.     {
  59.         _md5.update(bytes, 0, bytes.length);
  60.     }
  61.  
  62.     public byte[] digest()
  63.     {
  64.         byte arr[] = new byte[128];
  65.         int res;
  66.         try
  67.         {
  68.             res = _md5.digest(arr, 0, 128);
  69.         }
  70.         catch(Exception x)
  71.         {
  72.             return null;
  73.         }
  74.         byte resArr[] = new byte[res];
  75.         System.arraycopy(arr, 0, resArr, 0, res);
  76.         return resArr;
  77.     }
  78.  
  79.     MessageDigest _md5;
  80. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×