feat: runtime.loadJar() cache dex

This commit is contained in:
hyb1996
2018-10-10 00:31:55 +08:00
parent 94395544b7
commit 6cebca179c
8 changed files with 90 additions and 19 deletions

View File

@@ -0,0 +1,26 @@
package com.stardust.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5 {
public static byte[] md5Bytes(String message) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(message.getBytes());
return md5.digest();
}
public static String md5(String message) throws NoSuchAlgorithmException {
byte[] bytes = md5Bytes(message);
StringBuilder hexString = new StringBuilder(32);
for (byte b : bytes) {
String hex = Integer.toHexString(0xFF & b);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
}
}