首页
社区
课程
招聘
[求助]算法求助
发表于: 2012-5-31 21:59 6220

[求助]算法求助

2012-5-31 21:59
6220
package com.tcsl;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.database.Cursor;
import android.os.Environment;
import com.tcsl.utils.a;
import java.io.File;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public final class d
{
private com.tcsl.db.c a = null;
private com.tcsl.db.c b = null;
private Context c;
private String d = "";
private String e = "";
private String f = "";
private String g = "";
private File h = null;
private File i = null;
private int j = null;
private m k;
private Boolean l;
private String m;

public d(Context paramContext)
{
Object localObject = Boolean.valueOf(true);
this.l = ((Boolean)localObject);
this.c = paramContext;
localObject = new StringBuilder();
File localFile = this.c.getFilesDir().getAbsoluteFile();
localObject = localFile + "/image/item_small";
this.m = ((String)localObject);
String str = this.m;
localObject = new File(str);
if (((File)localObject).exists())
return;
((File)localObject).mkdirs();
}

public static com.tcsl.db.c b(Context paramContext)
{
return new com.tcsl.db.c(paramContext, "TCSLData.db");
}

private static File g(String paramString)
{
int i1 = 0;
boolean bool = Environment.getExternalStorageState().equals("mounted");
if (!bool);
while (true)
{
return i1;
String str1 = String.valueOf(Environment.getExternalStorageDirectory().getAbsolutePath());
String str2 = str1 + "/" + paramString;
File localFile = new File(str2);
if (localFile.exists())
localObject = localFile;
String str3 = "/sdcard/" + paramString;
localFile = new File(str3);
if (!localFile.exists())
continue;
Object localObject = localFile;
}
}

private static String h(String paramString)
{
MessageDigest localMessageDigest1 = 0;
MessageDigest localMessageDigest2 = MessageDigest.getInstance("SHA-1");
Object localObject = paramString.getBytes();
localMessageDigest2.update(localObject);
int i1 = 16;
localObject = new char[] { 102, 101, 50, 51, 100, 53, 54, 55, 56, 57, 97, 98, 99, 52, 49, 48 };
String str;
try
{
MessageDigest localMessageDigest3 = MessageDigest.getInstance("SHA-1");
byte[] arrayOfByte = paramString.getBytes();
localMessageDigest3.update(arrayOfByte);
arrayOfByte = localMessageDigest3.digest();
int i2 = arrayOfByte.length;
char[] arrayOfChar = new char[i2 * 2];
localMessageDigest3 = localMessageDigest1;
if (localMessageDigest1 >= i2)
{
str = new String(arrayOfChar);
label170: return str;
}
int i3 = arrayOfByte[str];
int i4 = localMessageDigest3 + 1;
int i5 = i3 >>> 4 & 0xF;
int i6 = localObject[i5];
arrayOfChar[localMessageDigest3] = i6;
int i7 = i4 + 1;
int i8 = i3 & 0xF;
int i9 = localObject[i8];
arrayOfChar[i4] = i9;
++str;
}
catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
{
localNoSuchAlgorithmException.printStackTrace();
str = "";
break label170:
}
}

private static String i(String paramString)
{
MessageDigest localMessageDigest1 = 0;
int i1 = 16;
char[] arrayOfChar1 = { 48, 102, 50, 51, 100, 53, 54, 55, 56, 57, 97, 98, 99, 52, 101, 49 };
String str;
try
{
MessageDigest localMessageDigest2 = MessageDigest.getInstance("SHA-1");
byte[] arrayOfByte = paramString.getBytes();
localMessageDigest2.update(arrayOfByte);
arrayOfByte = localMessageDigest2.digest();
int i2 = arrayOfByte.length;
char[] arrayOfChar2 = new char[i2 * 2];
localMessageDigest2 = localMessageDigest1;
if (localMessageDigest1 >= i2)
{
str = new String(arrayOfChar2);
label154: return str;
}
int i3 = arrayOfByte[str];
int i4 = localMessageDigest2 + 1;
int i5 = i3 >>> 4 & 0xF;
int i6 = arrayOfChar1[i5];
arrayOfChar2[localMessageDigest2] = i6;
int i7 = i4 + 1;
int i8 = i3 & 0xF;
int i9 = arrayOfChar1[i8];
arrayOfChar2[i4] = i9;
++str;
}
catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
{
localNoSuchAlgorithmException.printStackTrace();
str = "";
break label154:
}
}

private SharedPreferences t()
{
return this.c.getSharedPreferences("TCSLSetting", 0);
}

public final com.tcsl.db.c a(Context paramContext)
{
if (this.a == null)
{
com.tcsl.db.c localc = b(paramContext);
this.a = localc;
}
return this.a;
}

public final Boolean a()
{
boolean bool = null;
Object localObject1 = this.c.getDatabasePath("TCSLMenu.db").getAbsolutePath();
Object localObject2 = new File((String)localObject1);
localObject1 = ((File)localObject2).exists();
Boolean localBoolean1;
if (localObject1 == 0)
localBoolean1 = Boolean.valueOf(bool);
while (true)
{
return localBoolean1;
localObject1 = this.c;
localObject1 = c((Context)localObject1);
localObject2 = ((com.tcsl.db.c)localObject1).a("select 1 from TMK_Page where iType=2 limit 1", null);
try
{
((Cursor)localObject2).moveToFirst();
int i1;
if (((Cursor)localObject2).getCount() > 0)
i1 = 1;
Boolean localBoolean2 = Boolean.valueOf(i1);
((Cursor)localObject2).close();
((com.tcsl.db.c)localObject1).close();
}
finally
{
((Cursor)localObject2).close();
((com.tcsl.db.c)localObject1).close();
}
}
}

public final Boolean a(m paramm)
{
this.k = paramm;
Boolean localBoolean = d();
String str1 = t().getString("isFirstUse", "");
Object localObject = "1";
if (str1.compareTo((String)localObject) != 0)
{
t().edit().putString("isFirstUse", "1").commit();
c localc = new c(this);
new Thread(localc).start();
}
while (true)
{
return localBoolean;
String str2 = Environment.getExternalStorageState();
localObject = "mounted";
if (!str2.equals(localObject))
continue;
File localFile1 = g("TCSLData.db");
this.h = localFile1;
File localFile2 = g("TCSLMenu.db");
this.i = localFile2;
String str3 = this.c.getDatabasePath("TCSLData.db").getAbsolutePath();
localObject = new File(str3);
if ((this.h != null) || (this.i != null))
{
if (((File)localObject).exists())
{
Context localContext = this.c;
i locali = new i(this);
h localh = new h(this);
a.a(localContext, 2131165427, locali, localh);
}
File localFile3 = this.h;
File localFile4 = this.i;
z localz = new z(this, localFile3, localFile4);
new Thread(localz).start();
}
if (this.k == null)
continue;
this.k.a();
}
}

public final void a(int paramInt)
{
t().edit().putInt("serverPort", paramInt).commit();
}

public final void a(Boolean paramBoolean)
{
SharedPreferences.Editor localEditor = t().edit();
boolean bool = paramBoolean.booleanValue();
localEditor.putBoolean("ExitAppCheck", bool).commit();
}

public final void a(String paramString)
{
t().edit().putString("serverIP", paramString).commit();
}

public final Boolean b()
{
boolean bool = null;
Object localObject1 = this.c.getDatabasePath("TCSLMenu.db").getAbsolutePath();
Object localObject2 = new File((String)localObject1);
localObject1 = ((File)localObject2).exists();
Boolean localBoolean1;
if (localObject1 == 0)
localBoolean1 = Boolean.valueOf(bool);
while (true)
{
return localBoolean1;
localObject1 = this.c;
localObject1 = c((Context)localObject1);
localObject2 = ((com.tcsl.db.c)localObject1).a("select 1 from TMK_Page where iType=0 limit 1", null);
try
{
((Cursor)localObject2).moveToFirst();
int i1;
if (((Cursor)localObject2).getCount() > 0)
i1 = 1;
Boolean localBoolean2 = Boolean.valueOf(i1);
((Cursor)localObject2).close();
((com.tcsl.db.c)localObject1).close();
}
finally
{
((Cursor)localObject2).close();
((com.tcsl.db.c)localObject1).close();
}
}
}

public final void b(int paramInt)
{
t().edit().putInt("Timeout", paramInt).commit();
}

public final void b(Boolean paramBoolean)
{
SharedPreferences.Editor localEditor = t().edit();
boolean bool = paramBoolean.booleanValue();
localEditor.putBoolean("ShowDiscount", bool).commit();
}

public final void b(String paramString)
{
t().edit().putString("DevCode", paramString).commit();
}

public final com.tcsl.db.c c(Context paramContext)
{
if (this.b == null)
{
com.tcsl.db.c localc = new com.tcsl.db.c(paramContext, "TCSLMenu.db");
this.b = localc;
}
return this.b;
}

public final Boolean c()
{
boolean bool = null;
Object localObject1 = this.c.getDatabasePath("TCSLMenu.db").getAbsolutePath();
Object localObject2 = new File((String)localObject1);
localObject1 = ((File)localObject2).exists();
Boolean localBoolean1;
if (localObject1 == 0)
localBoolean1 = Boolean.valueOf(bool);
while (true)
{
return localBoolean1;
localObject1 = this.c;
localObject1 = c((Context)localObject1);
localObject2 = ((com.tcsl.db.c)localObject1).a("select 1 from TMK_Page where iType=1 limit 1", null);
try
{
((Cursor)localObject2).moveToFirst();
int i1;
if (((Cursor)localObject2).getCount() > 0)
i1 = 1;
Boolean localBoolean2 = Boolean.valueOf(i1);
((Cursor)localObject2).close();
((com.tcsl.db.c)localObject1).close();
}
finally
{
((Cursor)localObject2).close();
((com.tcsl.db.c)localObject1).close();
}
}
}

public final void c(int paramInt)
{
this.j = paramInt;
}

public final void c(Boolean paramBoolean)
{
SharedPreferences.Editor localEditor = t().edit();
boolean bool = paramBoolean.booleanValue();
localEditor.putBoolean("ShowCall", bool).commit();
}

public final void c(String paramString)
{
t().edit().putString("TableCode", paramString).commit();
}

public final Boolean d()
{
String str1 = this.c.getDatabasePath("TCSLMenu.up").getAbsolutePath();
Object localObject = this.c.getDatabasePath("TCSLMenu.db").getAbsolutePath();
File localFile = new File((String)localObject);
localObject = new File(str1);
if (((File)localObject).exists())
{
localFile.delete();
((File)localObject).renameTo(localFile);
}
String str2 = this.c.getDatabasePath("TCSLData.up").getAbsolutePath();
localObject = this.c.getDatabasePath("TCSLData.db").getAbsolutePath();
localFile = new File((String)localObject);
localObject = new File(str2);
if (((File)localObject).exists())
{
localFile.delete();
((File)localObject).renameTo(localFile);
}
com.tcsl.db.c localc1 = b(this.c);
this.a = localc1;
Context localContext = this.c;
com.tcsl.db.c localc2 = new com.tcsl.db.c(localContext, "TCSLMenu.db");
this.b = localc2;
return (Boolean)Boolean.valueOf(localFile.exists());
}

public final void d(Boolean paramBoolean)
{
SharedPreferences.Editor localEditor = t().edit();
boolean bool = paramBoolean.booleanValue();
localEditor.putBoolean("AutoChangeMode", bool).commit();
}

public final void d(String paramString)
{
t().edit().putString("TableName", paramString).commit();
}

public final int e()
{
return t().getInt("serverPort", 8009);
}

public final void e(String paramString)
{
t().edit().putString("ExitAppCheckPWD", paramString).commit();
}

public final String f()
{
int i1 = 16;
String str = "0123456789ABCDEF";
try
{
Context localContext = this.c;
label29: label47: label55: str = new com.tcsl.utils.i(localContext).a();
}
catch (Exception localException1)
{
try
{
str = h(str);
if (str.length() <= i1)
break label55;
str = str.substring(null, i1).toUpperCase();
return str;
}
catch (Exception localException2)
{
localException2.printStackTrace();
break label29:
str = str.toUpperCase();
break label47:
localException1 = localException1;
}
}
}

public final void f(String paramString)
{
t().edit().putString("SNSCode", paramString).commit();
}

public final String g()
{
return t().getString("serverIP", "192.168.4.139");
}

public final int h()
{
return t().getInt("Timeout", 15);
}

public final String i()
{
return t().getString("DevCode", "001");
}

public final String j()
{
return t().getString("TableCode", "");
}

public final String k()
{
return t().getString("TableName", "");
}

public final int l()
{
return this.j;
}

public final boolean m()
{
Object localObject1 = t().getString("SNSCode", "");
String str = s();
localObject1 = ((String)localObject1).compareTo(str);
int i1;
if (localObject1 == 0)
i1 = 1;
while (true)
{
return i1;
Object localObject2 = null;
}
}

public final boolean n()
{
return t().getBoolean("ExitAppCheck", null);
}

public final String o()
{
return t().getString("ExitAppCheckPWD", "");
}

public final boolean p()
{
return t().getBoolean("ShowDiscount", true);
}

public final boolean q()
{
return t().getBoolean("ShowCall", true);
}

public final boolean r()
{
return t().getBoolean("AutoChangeMode", true);
}

public final String s()
{
int i1 = 16;
String str1 = "";
String str2;
try
{
str1 = h(i(h(f())));
int i2 = str1.length();
if (i2 > i1)
{
str2 = str1.substring(0, 16).toUpperCase();
return str2;
}
str2 = str1.toUpperCase();
}
catch (Exception localException)
{
str2 = str1;
localException.printStackTrace();
}
}
}

/* Location: E:\new\classes.dex.dex2jar.jar
* Qualified Name: com.tcsl.d
* JD-Core Version: 0.5.4
*/

大概的意思是将网卡的MAC地址取十六进制的大写,经过三次SHA-1运算取前十六位作为注册码!
请大侠们帮忙看看!
最好能帮忙写个算法注册机!

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 826
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
一堆代码,没有一点注释。。。
2012-6-1 00:30
0
游客
登录 | 注册 方可回帖
返回
//