package com.mbridge.msdk.foundation.tools; import com.umeng.analytics.pro.cb; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; import java.nio.channels.FileChannel; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /* compiled from: SameFileMD5 */ public class t { protected static char[] a = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; protected static MessageDigest b = null; private static String c = "SameFileMD5"; static { b = null; try { b = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { PrintStream printStream = System.err; printStream.println(t.class.getName() + "初始化失败,MessageDigest不支持MD5Util."); e.printStackTrace(); } } /* JADX WARNING: Removed duplicated region for block: B:16:0x003d */ /* JADX WARNING: Removed duplicated region for block: B:18:0x0045 */ /* JADX WARNING: Removed duplicated region for block: B:21:? A[RETURN, SYNTHETIC] */ public static String a(File file) throws IOException { Throwable th; Exception e; FileInputStream fileInputStream = null; try { FileInputStream fileInputStream2 = new FileInputStream(file); try { b.update(fileInputStream2.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, file.length())); byte[] digest = b.digest(); String a2 = a(digest, 0, digest.length); fileInputStream2.close(); return a2; } catch (Exception e2) { e = e2; fileInputStream = fileInputStream2; try { w.b(c, "FILE EXCEPTION", e); if (fileInputStream != null) { return ""; } fileInputStream.close(); return ""; } catch (Throwable th2) { th = th2; if (fileInputStream != null) { fileInputStream.close(); } throw th; } } catch (Throwable th3) { th = th3; fileInputStream = fileInputStream2; if (fileInputStream != null) { } throw th; } } catch (Exception e3) { e = e3; w.b(c, "FILE EXCEPTION", e); if (fileInputStream != null) { } } } private static String a(byte[] bArr, int i, int i2) { StringBuffer stringBuffer = new StringBuffer(i2 * 2); int i3 = i2 + i; while (i < i3) { byte b2 = bArr[i]; char[] cArr = a; char c2 = cArr[(b2 & 240) >> 4]; char c3 = cArr[b2 & cb.m]; stringBuffer.append(c2); stringBuffer.append(c3); i++; } return stringBuffer.toString(); } }