Github user YorkShen commented on a diff in the pull request:
https://github.com/apache/incubator-weex/pull/774#discussion_r143443048
--- Diff: android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
---
@@ -130,4 +134,26 @@ public static boolean saveFile(String path, byte[]
content, Context context) {
}
return false;
}
+
+ public static String md5(String template){
+ try {
+ if(template == null){
+ return "";
+ }
+ return md5(template.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ return "";
+ }
+ }
+
+ public static String md5(byte[] bts){
+ try {
+ MessageDigest digest = MessageDigest.getInstance("MD5");
+ digest.update(bts);
+ BigInteger bigInt = new BigInteger(1, digest.digest());
--- End diff --
Using new String(byte []) is a better choice.
---