· 4 years ago · Nov 02, 2020, 07:48 PM
1// package p027ru.tinkoff.appsec.myapplication;
2
3// import android.content.ContentValues;
4// import android.os.Bundle;
5// import android.support.p021v7.app.C0438c;
6import java.security.MessageDigest;
7import java.security.NoSuchAlgorithmException;
8import java.security.spec.InvalidKeySpecException;
9import java.util.Arrays;
10import javax.crypto.SecretKey;
11import javax.crypto.SecretKeyFactory;
12import javax.crypto.spec.PBEKeySpec;
13
14/* renamed from: ru.tinkoff.appsec.myapplication.MainActivity */
15public class MainActivity /* extends C0438c */ {
16 /* renamed from: a */
17 public static String m3286a(byte[] bArr) {
18 StringBuilder sb = new StringBuilder(bArr.length * 2);
19 int length = bArr.length;
20 for (int i = 0; i < length; i++) {
21 sb.append(String.format("%02x", new Object[]{Byte.valueOf(bArr[i])}));
22 }
23 return sb.toString();
24 }
25
26 /* renamed from: a */
27 public static byte[] m3287a(byte[] bArr, byte[] bArr2) {
28 MessageDigest messageDigest = null;
29 try {
30 messageDigest = MessageDigest.getInstance("SHA-256");
31 } catch (NoSuchAlgorithmException e) {
32 }
33 messageDigest.update(bArr);
34 messageDigest.update(bArr2);
35 return messageDigest.digest();
36 }
37
38 /* renamed from: a */
39 private static final byte[] m3288a(char[] cArr, byte[] bArr) throws NoSuchAlgorithmException, InvalidKeySpecException {
40 PBEKeySpec pBEKeySpec;
41 Throwable th;
42 SecretKey secretKey = null;
43 SecretKeyFactory instance = SecretKeyFactory.getInstance("PBKDF2withHmacSHA1");
44 pBEKeySpec = new PBEKeySpec(cArr, bArr, 1024, 256);
45 Arrays.fill(cArr, '?');
46 secretKey = instance.generateSecret(pBEKeySpec);
47 pBEKeySpec.clearPassword();
48 return secretKey.getEncoded();
49 }
50
51 /* renamed from: k */
52 public static String mo3304k() throws NoSuchAlgorithmException, InvalidKeySpecException {
53 String string = "aa5f12bead357fd6f9b0e8c8b973155001a026f4a56a7f3861ae0b8921e67c8ea0d498f73d7897e870714a84735b5c0192dcaded558af0f01e093946233ebd48";
54 int length = string.length();
55 int i = length / 2;
56 byte[] bytes = string.substring(0, length / 2).substring(0, i / 2).getBytes();
57 byte[] bytes2 = string.substring(0, length / 2).substring(i / 2, i).getBytes();
58 char[] charArray = string.substring(length / 2, length).substring(0, i / 2).toCharArray();
59 byte[] bytes3 = string.substring(length / 2, length).substring(i / 2, i).getBytes();
60 byte[] a = m3287a(bytes2, bytes);
61 byte[] a2 = m3288a(charArray, bytes3);
62 byte[] bArr = new byte[(a.length + a2.length)];
63 System.arraycopy(a, 0, bArr, 0, a.length);
64 System.arraycopy(a2, 0, bArr, a.length, a2.length);
65 byte[] bArr2 = new byte[(bArr.length / 4)];
66 for (int i2 = 0; i2 < bArr.length; i2++) {
67 if (i2 % 4 == 0) {
68 bArr2[i2 / 4] = bArr[i2];
69 }
70 }
71 return m3286a(bArr2);
72 }
73
74 /* access modifiers changed from: protected */
75 public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeySpecException {
76 // super.onCreate(bundle);
77 // setContentView((int) R.layout.activity_main);
78 String k = mo3304k();
79 System.out.println(k);
80 // ContentValues contentValues = new ContentValues();
81 // contentValues.put("flag", k);
82 // getContentResolver().insert(SecretProvider.f2524a, contentValues);
83 }
84}
85