11
11
import android .os .Build ;
12
12
import android .util .DisplayMetrics ;
13
13
14
- import java .math .BigInteger ;
15
- import java .security .MessageDigest ;
16
14
import java .util .Locale ;
17
15
import java .util .Map ;
18
16
19
- import static com .adjust .sdk .Constants .ENCODING ;
20
17
import static com .adjust .sdk .Constants .HIGH ;
21
18
import static com .adjust .sdk .Constants .LARGE ;
22
19
import static com .adjust .sdk .Constants .LONG ;
23
20
import static com .adjust .sdk .Constants .LOW ;
24
- import static com .adjust .sdk .Constants .MD5 ;
25
21
import static com .adjust .sdk .Constants .MEDIUM ;
26
22
import static com .adjust .sdk .Constants .NORMAL ;
27
- import static com .adjust .sdk .Constants .SHA1 ;
28
23
import static com .adjust .sdk .Constants .SMALL ;
29
24
import static com .adjust .sdk .Constants .XLARGE ;
30
25
@@ -214,7 +209,7 @@ private String getMacSha1(String macAddress) {
214
209
if (macAddress == null ) {
215
210
return null ;
216
211
}
217
- String macSha1 = sha1 (macAddress );
212
+ String macSha1 = Util . sha1 (macAddress );
218
213
219
214
return macSha1 ;
220
215
}
@@ -224,7 +219,7 @@ private String getMacShortMd5(String macAddress) {
224
219
return null ;
225
220
}
226
221
String macShort = macAddress .replaceAll (":" , "" );
227
- String macShortMd5 = md5 (macShort );
222
+ String macShortMd5 = Util . md5 (macShort );
228
223
229
224
return macShortMd5 ;
230
225
}
@@ -237,33 +232,6 @@ private String getAndroidId(Context context, boolean isGooglePlayServicesAvailab
237
232
}
238
233
}
239
234
240
- private String sha1 (final String text ) {
241
- return hash (text , SHA1 );
242
- }
243
-
244
- private String md5 (final String text ) {
245
- return hash (text , MD5 );
246
- }
247
-
248
- private String hash (final String text , final String method ) {
249
- String hashString = null ;
250
- try {
251
- final byte [] bytes = text .getBytes (ENCODING );
252
- final MessageDigest mesd = MessageDigest .getInstance (method );
253
- mesd .update (bytes , 0 , bytes .length );
254
- final byte [] hash = mesd .digest ();
255
- hashString = convertToHex (hash );
256
- } catch (Exception e ) {
257
- }
258
- return hashString ;
259
- }
260
-
261
- private static String convertToHex (final byte [] bytes ) {
262
- final BigInteger bigInt = new BigInteger (1 , bytes );
263
- final String formatString = "%0" + (bytes .length << 1 ) + "x" ;
264
- return String .format (Locale .US , formatString , bigInt );
265
- }
266
-
267
235
private String getFacebookAttributionId (final Context context ) {
268
236
try {
269
237
final ContentResolver contentResolver = context .getContentResolver ();
0 commit comments