354798ggg
2023-08-29 fd0c7c174d7b7313aa49061df05350405a3c1bf1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
 
package com.product.data.sync.service.media;
import java.io.File;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
 
public class Encryption {
    private int intPrivateKey = 0;
    private static final long MaxInt = (long)Math.pow(2.0D, 32.0D);
    private int[] intConstKey = new int[]{1556696929, 1266038903, 1265722019, 1265722531, 1265658509, 1265282947, 1263528397, 1263599759, 1263487033, 1263648241, 1262235517, 1262210177, 1261371079, 1261525493, 1261118363, 1260675071, 1260706169, 1260299731, 1260230359, 1259026997, 1258887283, 1258865891, 1258626371, 1258503781, 1258482227, 1258579643, 1258190971, 1258098757, 1257611279, 1257724121, 1257273319, 1257361279, 1256913187, 1256892151, 1256455111, 1256408429, 1060988843, 1028046497, 1059548141, 1059702103, 1059282011, 1057910353, 1057261279, 1056410731, 1027302959, 1056241757, 1053532217, 1053109769, 1052145631, 1052156549, 1052311109, 1052138359, 1051307749, 1051455023, 1030905121, 1030546703, 1030613851, 1030517641, 1029296581, 1029412469, 1028968387, 1028847733, 1028118731, 1028044769};
    private int[] intUserKey = new int[64];
    private int[] intPosition = new int[64];
    private static int encryptionInfo = 3;
    private static long readTimer = 0L;
    public static final long lngREMAINTIMER = 600000L;
    public static final long abc = Long.parseLong("7776000000");
 
    public Encryption(String strKey) {
        int[] intData = this.getStringLong(strKey);
        this.intPrivateKey = 0;
        int i;
        if (intData != null) {
            for(i = 0; i < intData.length; ++i) {
                this.intPrivateKey ^= intData[i];
            }
        }
 
        intData = this.getStringLong(String.valueOf(this.intPrivateKey));
 
        for(i = 0; i < intData.length; ++i) {
            this.intPrivateKey ^= intData[i];
        }
 
        this.processKeyGene();
    }
 
    public Encryption() {
    }
 
    public int[] getStringLong(String strString) {
        byte[] byteString = strString.getBytes();
        int intI = 0;
        int intIndex = -1;
        if (byteString.length == 0) {
            return null;
        } else {
            int[] intData;
            int intByte;
            for(intData = new int[(byteString.length - 1) / 4 + 1]; intI < byteString.length; intData[intIndex] = (intData[intIndex] << 8) + intByte) {
                if (intI % 4 == 0) {
                    ++intIndex;
                    intData[intIndex] = 0;
                }
 
                intByte = byteString[intI++];
                if (intByte < 0) {
                    intByte += 256;
                }
            }
 
            return intData;
        }
    }
 
    public String getLongString(int[] intData) {
        String strData = "";
        if (intData != null) {
            int[] intLocation = new int[]{-16777216, 16711680, 65280, 255};
            int[] intMove = new int[]{24, 16, 8, 0};
            int intIndex = 0;
            int intI = 0;
            int intLen = (intData.length - 1) * 4 + 1;
            int tmp = intData[intData.length - 1];
            if (tmp < 0) {
                intLen += 3;
            } else {
                while(tmp > 255) {
                    ++intLen;
                    tmp >>= 8;
                }
            }
 
            byte[] bytString = new byte[intLen];
            intLen = 0;
 
            while(intI < intData.length - 1) {
                bytString[intLen++] = (byte)((intData[intI] & intLocation[intIndex]) >> intMove[intIndex]);
                ++intIndex;
                if (intIndex > 3) {
                    ++intI;
                    intIndex = 0;
                }
            }
 
            tmp = intData[intData.length - 1];
 
            for(intI = bytString.length - 1; intI >= intLen; --intI) {
                bytString[intI] = (byte)(tmp & 255);
                tmp >>= 8;
            }
            try {
                //默认工作空间字符集
                strData = new String(bytString,"GBK");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
 
        return strData;
    }
 
    public int[] getHexLong(String strHex) {
        if (strHex.length() == 0) {
            return null;
        } else {
            int[] intData = new int[(strHex.length() - 1) / 8 + 1];
            String strSubHex = "";
 
            for(int i = 0; i < strHex.length(); i += 8) {
                if (i + 8 < strHex.length()) {
                    strSubHex = strHex.substring(i, i + 8);
                } else {
                    strSubHex = strHex.substring(i);
                }
 
                intData[i / 8] = (int)Long.parseLong(strSubHex, 16);
            }
 
            return intData;
        }
    }
 
    public String getLongHex(int[] intData) {
        String strHex = "";
        String strSubHex = "";
        if (intData != null) {
            for(int i = 0; i < intData.length - 1; ++i) {
                strSubHex = Integer.toHexString(intData[i]).toUpperCase();
 
                for(int j = strSubHex.length(); j < 8; ++j) {
                    strSubHex = "0" + strSubHex;
                }
 
                strHex = strHex + strSubHex;
            }
 
            strSubHex = Integer.toHexString(intData[intData.length - 1]).toUpperCase();
            if (strSubHex.length() % 2 != 0) {
                strSubHex = "0" + strSubHex;
            }
 
            strHex = strHex + strSubHex;
        }
 
        return strHex;
    }
 
    private void processKeyGene() {
        boolean[] blnInGene = new boolean[64];
        int intGCount = -1;
        int[] intGene = new int[64];
        String strPrivateKey = String.valueOf(this.intPrivateKey);
 
        int i;
        for(i = 0; i < 64; ++i) {
            this.intUserKey[i] = this.intConstKey[i];
            blnInGene[i] = false;
            this.intPosition[i] = i;
            intGene[i] = -1;
        }
 
        int intG;
        for(i = 0; i < strPrivateKey.length(); ++i) {
            if (strPrivateKey.substring(i, i + 1).equals("-")) {
                intG = 0;
            } else {
                intG = Integer.parseInt(strPrivateKey.substring(i, i + 1));
            }
 
            if (!blnInGene[intG]) {
                blnInGene[intG] = true;
                this.intPrivateKey ^= this.intUserKey[intG];
                ++intGCount;
                intGene[intGCount] = intG;
            }
        }
 
        int intCount = intGCount;
 
        int j;
        for(i = 0; i <= intCount; ++i) {
            if (intGene[i] > 0 && intGene[i] < 7) {
                for(j = 0; j <= intCount; ++j) {
                    intG = intGene[i] * 10 + intGene[j];
                    if (intG < 64 && !blnInGene[intG]) {
                        ++intGCount;
                        intGene[intGCount] = intG;
                        this.intPrivateKey ^= this.intUserKey[intG];
                    }
                }
            }
        }
 
        ++intGCount;
 
        for(i = 0; i < 64; ++i) {
            j = (int)((double)intGene[i % intGCount] * Math.pow((double)i, 2.0D)) & 31;
            intG = this.intUserKey[i];
            this.intUserKey[i] = this.intUserKey[j];
            this.intUserKey[j] = intG;
            intG = this.intPosition[i];
            this.intPosition[i] = this.intPosition[j];
            this.intPosition[j] = intG;
        }
 
    }
 
    public String encryptString(String strString, boolean blnGetHex) {
        if (EncrypUtil.isFingerprint(strString)) {
            return EncrypUtil.getFingerValue(strString);
        } else {
            return blnGetHex ? this.getLongHex(this.encryptData(this.getStringLong(strString), true)) : this.getLongString(this.encryptData(this.getStringLong(strString), true));
        }
    }
 
    public String encryptString(String strString) {
        return this.getLongString(this.encryptData(this.getStringLong(strString), true));
    }
 
    public String decryptionString(String strString, boolean blnIsHex) {
        return blnIsHex ? this.getLongString(this.encryptData(this.getHexLong(strString), false)) : this.getLongString(this.encryptData(this.getStringLong(strString), false));
    }
 
    public String decryptionString(String strString) {
        return this.getLongString(this.encryptData(this.getStringLong(strString), false));
    }
 
    public int[] encryptData(int[] intData, boolean blnEncryption) {
        if (intData == null) {
            return null;
        } else {
            int intLen = intData.length;
            int[] intEncryptData = new int[intLen];
            int[] intModPosition = (int[])null;
            int intMod = intLen & 63;
            int i;
            int j;
            if (intMod > 0) {
                intModPosition = new int[intMod];
                i = -1;
 
                for(j = 0; j < 64; ++j) {
                    if (this.intPosition[j] < intMod) {
                        ++i;
                        intModPosition[i] = this.intPosition[j];
                    }
                }
            }
 
            if (blnEncryption) {
                for(i = 0; i < intLen; ++i) {
                    if (intLen - i > 63) {
                        for(j = 0; j < 64; ++j) {
                            intEncryptData[i + j] = intData[i + this.intPosition[j]] ^ this.intPrivateKey ^ this.intUserKey[j];
                        }
 
                        i += 63;
                    } else {
                        for(j = 0; j < intLen - i; ++j) {
                            intEncryptData[i + j] = intData[i + intModPosition[j]] ^ this.intPrivateKey ^ this.intUserKey[j];
                        }
 
                        i = intLen;
                    }
                }
            } else {
                for(i = 0; i < intData.length; ++i) {
                    if (intLen - i > 63) {
                        for(j = 0; j < 64; ++j) {
                            intEncryptData[i + this.intPosition[j]] = intData[i + j] ^ this.intPrivateKey ^ this.intUserKey[j];
                        }
 
                        i += 63;
                    } else {
                        for(j = 0; j < intLen - i; ++j) {
                            intEncryptData[i + intModPosition[j]] = intData[i + j] ^ this.intPrivateKey ^ this.intUserKey[j];
                        }
 
                        i = intLen;
                    }
                }
            }
 
            return intEncryptData;
        }
    }
 
    public static int getEncryptionMachineInfo() {
        return encryptionInfo;
    }
 
    public byte[] decryptionFile(String strFileName) {
        byte[] bytData = (byte[])null;
        File file = new File(strFileName);
        int fleLen = (int)file.length();
        if (fleLen > 8) {
            try {
                FileInputStream in = new FileInputStream(file);
                int srcLength = 0;
                bytData = new byte[4];
 
                int intIndex;
                for(int i = 0; i < 2; ++i) {
                    in.read(bytData);
 
                    for(intIndex = 3; intIndex >= 0; --intIndex) {
                        if (bytData[intIndex] < 0) {
                            srcLength = (srcLength << 8) + 256 + bytData[intIndex];
                        } else {
                            srcLength = (srcLength << 8) + bytData[intIndex];
                        }
                    }
                }
 
                fleLen -= 8;
                bytData = new byte[fleLen];
                in.read(bytData);
                in.close();
                if (fleLen % 4 == 0) {
                    fleLen /= 4;
                } else {
                    fleLen = fleLen / 4 + 1;
                }
 
                int[] intData = new int[fleLen];
                intIndex = 0;
 
                int i;
                for(i = 0; i < fleLen; ++i) {
                    intIndex += 4;
 
                    for(int j = 1; j < 5; ++j) {
                        int index = intIndex - j;
                        if (index < bytData.length) {
                            if (bytData[index] < 0) {
                                intData[i] = (intData[i] << 8) + 256 + bytData[index];
                            } else {
                                intData[i] = (intData[i] << 8) + bytData[index];
                            }
                        }
                    }
                }
 
                intData = this.encryptData(intData, false);
                bytData = new byte[srcLength];
                intIndex = 0;
 
                for(i = 0; i < fleLen; ++i) {
                    long lngData = intData[i] < 0 ? MaxInt + (long)intData[i] : (long)intData[i];
                    intIndex += 4;
 
                    for(int j = 4; j > 0; --j) {
                        int index = intIndex - j;
                        if (index < srcLength) {
                            bytData[intIndex - j] = (byte)((int)(lngData & 255L));
                            lngData >>= 8;
                        }
                    }
                }
            } catch (Exception var14) {
                var14.printStackTrace();
            }
        }
 
        return bytData;
    }
 
    public static void main(String[] args) {
        Encryption en = new Encryption("199678B2");
        System.out.print(en.encryptString("199678B2", true));
    }
}