Hashing.java
7.97 KB
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
package com.google.common.hash;
import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import java.util.Iterator;
import java.util.zip.Adler32;
import java.util.zip.CRC32;
import java.util.zip.Checksum;
import javax.annotation.Nullable;
import qr;
import qv;
import qw;
import qx;
import qy;
import qz;
@Beta
public final class Hashing
{
private static final int a = (int)System.currentTimeMillis();
public static HashFunction adler32()
{
return a.a;
}
public static HashCode combineOrdered(Iterable<HashCode> paramIterable)
{
Object localObject = paramIterable.iterator();
Preconditions.checkArgument(((Iterator)localObject).hasNext(), "Must be at least 1 hash code to combine.");
localObject = new byte[((HashCode)((Iterator)localObject).next()).bits() / 8];
paramIterable = paramIterable.iterator();
if (paramIterable.hasNext())
{
byte[] arrayOfByte = ((HashCode)paramIterable.next()).asBytes();
if (arrayOfByte.length == localObject.length) {}
for (boolean bool = true;; bool = false)
{
Preconditions.checkArgument(bool, "All hashcodes must have the same bit length.");
int i = 0;
while (i < arrayOfByte.length)
{
localObject[i] = ((byte)(localObject[i] * 37 ^ arrayOfByte[i]));
i += 1;
}
break;
}
}
return HashCode.a((byte[])localObject);
}
public static HashCode combineUnordered(Iterable<HashCode> paramIterable)
{
Object localObject = paramIterable.iterator();
Preconditions.checkArgument(((Iterator)localObject).hasNext(), "Must be at least 1 hash code to combine.");
localObject = new byte[((HashCode)((Iterator)localObject).next()).bits() / 8];
paramIterable = paramIterable.iterator();
if (paramIterable.hasNext())
{
byte[] arrayOfByte = ((HashCode)paramIterable.next()).asBytes();
if (arrayOfByte.length == localObject.length) {}
for (boolean bool = true;; bool = false)
{
Preconditions.checkArgument(bool, "All hashcodes must have the same bit length.");
int i = 0;
while (i < arrayOfByte.length)
{
localObject[i] = ((byte)(localObject[i] + arrayOfByte[i]));
i += 1;
}
break;
}
}
return HashCode.a((byte[])localObject);
}
public static int consistentHash(long paramLong, int paramInt)
{
int i = 0;
if (paramInt > 0) {}
for (boolean bool = true;; bool = false)
{
Preconditions.checkArgument(bool, "buckets must be positive: %s", new Object[] { Integer.valueOf(paramInt) });
f localf = new f(paramLong);
for (;;)
{
double d = i + 1;
localf.a = (2862933555777941757L * localf.a + 1L);
int j = (int)(d / (((int)(localf.a >>> 33) + 1) / 2.147483648E9D));
if ((j < 0) || (j >= paramInt)) {
break;
}
i = j;
}
}
return i;
}
public static int consistentHash(HashCode paramHashCode, int paramInt)
{
return consistentHash(paramHashCode.padToLong(), paramInt);
}
public static HashFunction crc32()
{
return d.a;
}
public static HashFunction crc32c()
{
return e.a;
}
public static HashFunction goodFastHash(int paramInt)
{
int i = 1;
if (paramInt > 0) {}
for (boolean bool = true;; bool = false)
{
Preconditions.checkArgument(bool, "Number of bits must be positive");
paramInt = paramInt + 31 & 0xFFFFFFE0;
if (paramInt != 32) {
break;
}
return i.b;
}
if (paramInt <= 128) {
return h.b;
}
int k = (paramInt + 127) / 128;
HashFunction[] arrayOfHashFunction = new HashFunction[k];
arrayOfHashFunction[0] = h.b;
int j = a;
paramInt = i;
i = j;
while (paramInt < k)
{
i += 1500450271;
arrayOfHashFunction[paramInt] = murmur3_128(i);
paramInt += 1;
}
return new c(arrayOfHashFunction);
}
public static HashFunction md5()
{
return g.a;
}
public static HashFunction murmur3_128()
{
return h.a;
}
public static HashFunction murmur3_128(int paramInt)
{
return new qx(paramInt);
}
public static HashFunction murmur3_32()
{
return i.a;
}
public static HashFunction murmur3_32(int paramInt)
{
return new qy(paramInt);
}
public static HashFunction sha1()
{
return j.a;
}
public static HashFunction sha256()
{
return k.a;
}
public static HashFunction sha512()
{
return l.a;
}
public static HashFunction sipHash24()
{
return m.a;
}
public static HashFunction sipHash24(long paramLong1, long paramLong2)
{
return new qz(paramLong1, paramLong2);
}
static final class a
{
static final HashFunction a = Hashing.a(Hashing.b.b, "Hashing.adler32()");
}
static abstract enum b
implements Supplier<Checksum>
{
private final int c = 32;
private b(int paramInt) {}
public abstract Checksum a();
}
@VisibleForTesting
static final class c
extends qr
{
private final int b;
c(HashFunction... paramVarArgs)
{
super();
int k = paramVarArgs.length;
int j = 0;
while (i < k)
{
j += paramVarArgs[i].bits();
i += 1;
}
this.b = j;
}
final HashCode a(Hasher[] paramArrayOfHasher)
{
int i = 0;
byte[] arrayOfByte = new byte[this.b / 8];
int k = paramArrayOfHasher.length;
int j = 0;
while (i < k)
{
HashCode localHashCode = paramArrayOfHasher[i].hash();
j += localHashCode.writeBytesTo(arrayOfByte, j, localHashCode.bits() / 8);
i += 1;
}
return HashCode.a(arrayOfByte);
}
public final int bits()
{
return this.b;
}
public final boolean equals(@Nullable Object paramObject)
{
if ((paramObject instanceof c))
{
paramObject = (c)paramObject;
if ((this.b == ((c)paramObject).b) && (this.a.length == ((c)paramObject).a.length)) {}
}
else
{
return false;
}
int i = 0;
for (;;)
{
if (i >= this.a.length) {
break label74;
}
if (!this.a[i].equals(paramObject.a[i])) {
break;
}
i += 1;
}
label74:
return true;
}
public final int hashCode()
{
int j = this.b;
HashFunction[] arrayOfHashFunction = this.a;
int k = arrayOfHashFunction.length;
int i = 0;
while (i < k)
{
j ^= arrayOfHashFunction[i].hashCode();
i += 1;
}
return j;
}
}
static final class d
{
static final HashFunction a = Hashing.a(Hashing.b.a, "Hashing.crc32()");
}
static final class e
{
static final HashFunction a = new qv();
}
static final class f
{
long a;
public f(long paramLong)
{
this.a = paramLong;
}
}
static final class g
{
static final HashFunction a = new qw("MD5", "Hashing.md5()");
}
static final class h
{
static final HashFunction a = new qx(0);
static final HashFunction b = Hashing.murmur3_128(Hashing.a());
}
static final class i
{
static final HashFunction a = new qy(0);
static final HashFunction b = Hashing.murmur3_32(Hashing.a());
}
static final class j
{
static final HashFunction a = new qw("SHA-1", "Hashing.sha1()");
}
static final class k
{
static final HashFunction a = new qw("SHA-256", "Hashing.sha256()");
}
static final class l
{
static final HashFunction a = new qw("SHA-512", "Hashing.sha512()");
}
static final class m
{
static final HashFunction a = new qz(506097522914230528L, 1084818905618843912L);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/hash/Hashing.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/