(String src)
| 63 | } |
| 64 | |
| 65 | public static String md5(String src) { |
| 66 | try { |
| 67 | if (TextUtils.isEmpty(src)) return ""; |
| 68 | MessageDigest digest = MessageDigest.getInstance("MD5"); |
| 69 | byte[] bytes = digest.digest(src.getBytes(StandardCharsets.UTF_8)); |
| 70 | BigInteger no = new BigInteger(1, bytes); |
| 71 | StringBuilder sb = new StringBuilder(no.toString(16)); |
| 72 | while (sb.length() < 32) sb.insert(0, "0"); |
| 73 | return sb.toString().toLowerCase(); |
| 74 | } catch (NoSuchAlgorithmException e) { |
| 75 | return ""; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | public static String md5(File file) { |
| 80 | try { |
no test coverage detected