Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit 02fff70

Browse files
committed
Updated the code acording to the new Version.
1 parent a97512f commit 02fff70

File tree

1 file changed

+47
-43
lines changed

1 file changed

+47
-43
lines changed

src/me/checkium/vhackapi/Utils.java

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Utils {
2929

3030
static {
3131
assertionstatus = !Utils.class.desiredAssertionStatus();
32-
url = "https://vhackxt.com/v/1/";
32+
url = "https://api.vhack.cc/v/7/";
3333
md5s = "MD5";
3434
secret = "aeffl";
3535
byt = new byte[]{(byte) 65, (byte) 66, (byte) 67, (byte) 68, (byte) 69, (byte) 70, (byte) 71, (byte) 72, (byte) 73, (byte) 74, (byte) 75, (byte) 76, (byte) 77, (byte) 78, (byte) 79, (byte) 80, (byte) 81, (byte) 82, (byte) 83, (byte) 84, (byte) 85, (byte) 86, (byte) 87, (byte) 88, (byte) 89, (byte) 90, (byte) 97, (byte) 98, (byte) 99, (byte) 100, (byte) 101, (byte) 102, (byte) 103, (byte) 104, (byte) 105, (byte) 106, (byte) 107, (byte) 108, (byte) 109, (byte) 110, (byte) 111, (byte) 112, (byte) 113, (byte) 114, (byte) 115, (byte) 116, (byte) 117, (byte) 118, (byte) 119, (byte) 120, (byte) 121, (byte) 122, (byte) 48, (byte) 49, (byte) 50, (byte) 51, (byte) 52, (byte) 53, (byte) 54, (byte) 55, (byte) 56, (byte) 57, (byte) 45, (byte) 95};
@@ -68,35 +68,42 @@ public static JSONObject JSONRequest(String format, String data, String php){
6868
}
6969
return json;
7070
}
71-
72-
private static byte[] m9179a(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) {
73-
int i4 = 0;
74-
int i5 = (i2 > 1 ? (bArr[i + 1] << 24) >>> 16 : 0) | (i2 > 0 ? (bArr[i] << 24) >>> 8 : 0);
75-
if (i2 > 2) {
76-
i4 = (bArr[i + 2] << 24) >>> 24;
71+
72+
//I sometimes get "Request Failed"
73+
private static byte[] m9179a(byte[] arrby, int n2, int n3, byte[] arrby2, int n4, byte[] arrby3) {
74+
int n5 = n3 > 0 ? arrby[n2] << 24 >>> 8 : 0;
75+
int n6 = n3 > 1 ? arrby[n2 + 1] << 24 >>> 16 : 0;
76+
int n7 = n6 | n5;
77+
int n8 = 0;
78+
if (n3 > 2) {
79+
n8 = arrby[n2 + 2] << 24 >>> 24;
7780
}
78-
i4 |= i5;
79-
switch (i2) {
81+
int n9 = n8 | n7;
82+
switch (n3) {
83+
default: {
84+
return arrby2;
85+
}
86+
case 3: {
87+
arrby2[n4] = arrby3[n9 >>> 18];
88+
arrby2[n4 + 1] = arrby3[63 & n9 >>> 12];
89+
arrby2[n4 + 2] = arrby3[63 & n9 >>> 6];
90+
arrby2[n4 + 3] = arrby3[n9 & 63];
91+
return arrby2;
92+
}
93+
case 2: {
94+
arrby2[n4] = arrby3[n9 >>> 18];
95+
arrby2[n4 + 1] = arrby3[63 & n9 >>> 12];
96+
arrby2[n4 + 2] = arrby3[63 & n9 >>> 6];
97+
arrby2[n4 + 3] = 61;
98+
return arrby2;
99+
}
80100
case 1:
81-
bArr2[i3] = bArr3[i4 >>> 18];
82-
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
83-
bArr2[i3 + 2] = (byte) 61;
84-
bArr2[i3 + 3] = (byte) 61;
85-
break;
86-
case 2:
87-
bArr2[i3] = bArr3[i4 >>> 18];
88-
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
89-
bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63];
90-
bArr2[i3 + 3] = (byte) 61;
91-
break;
92-
case 3:
93-
bArr2[i3] = bArr3[i4 >>> 18];
94-
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
95-
bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63];
96-
bArr2[i3 + 3] = bArr3[i4 & 63];
97-
break;
98101
}
99-
return bArr2;
102+
arrby2[n4] = arrby3[n9 >>> 18];
103+
arrby2[n4 + 1] = arrby3[63 & n9 >>> 12];
104+
arrby2[n4 + 2] = 61;
105+
arrby2[n4 + 3] = 61;
106+
return arrby2;
100107
}
101108

102109
public static String generateUser(byte[] bArr, int i, int i2, byte[] bArr2, boolean z) {
@@ -108,7 +115,7 @@ public static String generateUser(byte[] bArr, int i, int i2, byte[] bArr2, bool
108115
return new String(a, 0, length);
109116
}
110117

111-
public static final String encryptString(String str) {
118+
public static final String hashString(String str) {
112119
try {
113120
MessageDigest instance = MessageDigest.getInstance(md5s);
114121
instance.update(str.getBytes());
@@ -181,11 +188,9 @@ public void checkServerTrusted(
181188

182189

183190
public static String generateURL(String str, String str2, String str3) {
184-
String[] strArr = new String[2];
185191
String[] split = str.split("::::");
186192
String[] split2 = str2.split("::::");
187193
long currentTimeMillis = System.currentTimeMillis() / 1000;
188-
String str4 = "{";
189194
JSONObject jSONObject = new JSONObject();
190195
for (int i = 0; i < split.length; i++) {
191196
try {
@@ -199,21 +204,20 @@ public static String generateURL(String str, String str2, String str3) {
199204
} catch (JSONException e2) {
200205
e2.printStackTrace();
201206
}
202-
str4 = jSONObject.toString();
203-
byte[] bytes = str4.getBytes();
204-
String a = generateUser(bytes, 0, bytes.length, byt, false);
205-
String a2 = encryptString(str4.length() + encryptString(currentTimeMillis + ""));
206-
String str5 = split2[0] + "" + encryptString(encryptString(split2[1]));
207-
str4 = encryptString(currentTimeMillis + "" + str4);
207+
String jsonString = jSONObject.toString();
208+
byte[] jsonStringBytes = jsonString.getBytes();
209+
String a = generateUser(jsonStringBytes, 0, jsonStringBytes.length, byt, false);
210+
String a2 = hashString(jsonString.length() + hashString(currentTimeMillis + ""));
211+
String str5 = split2[0] + "" + hashString(hashString(split2[1]));
212+
String str6 = hashString(currentTimeMillis + "" + jsonString);
208213
byte[] bytes2 = a2.getBytes();
209214
byte[] bytes3 = str5.getBytes();
210-
byte[] bytes4 = str4.getBytes();
211-
a2 = encryptString(secret + encryptString(encryptString(generateUser(bytes2, 0, bytes2.length, byt, false))));
212-
str5 = generateUser(bytes3, 0, bytes3.length, byt, false);
213-
str4 = encryptString(encryptString(a2 + encryptString(encryptString(str5) + generateUser(bytes4, 0, bytes4.length, byt, false))));
214-
strArr[0] = a;
215-
strArr[1] = str4;
216-
return url + str3 + "?user=" + a + "&pass=" + str4;
215+
byte[] bytes4 = str6.getBytes();
216+
String a3 = hashString(secret + hashString(hashString(generateUser(bytes2, 0, bytes2.length, byt, false))));
217+
String str6 = generateUser(bytes3, 0, bytes3.length, byt, false);
218+
String str7 = generateUser(bytes4, 0, bytes4.length, byt, false);
219+
String str8 = hashString(hashString(a3 + hashString(hashString(str6) + str7)));
220+
return url + str3 + "?user=" + a + "&pass=" + str8;
217221
}
218222

219223
}

0 commit comments

Comments
 (0)