实现公钥的导入
parent
ae120b0bd2
commit
4f961e7434
@ -0,0 +1,32 @@
|
|||||||
|
package com.xypower.common;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
|
/* loaded from: ds_base_2.0.9_23030112.aar:classes.jar:com/dowse/base/util/MD5Util.class */
|
||||||
|
public class MD5Util {
|
||||||
|
public static String md5(String input) {
|
||||||
|
try {
|
||||||
|
byte[] bytes = MessageDigest.getInstance("MD5").digest(input.getBytes());
|
||||||
|
return printHexBinary(bytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String md5(byte[] data) {
|
||||||
|
try {
|
||||||
|
byte[] bytes = MessageDigest.getInstance("MD5").digest(data);
|
||||||
|
return printHexBinary(bytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String printHexBinary(byte[] data) {
|
||||||
|
StringBuilder r = new StringBuilder(data.length * 2);
|
||||||
|
for (byte b : data) {
|
||||||
|
r.append(String.format("%x", new Integer(b & 255)));
|
||||||
|
}
|
||||||
|
return r.toString();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue