Commit 0f0d6ff2 authored by yanzg's avatar yanzg

Excel导出功能

parent d491b855
...@@ -14,6 +14,7 @@ import java.util.UUID; ...@@ -14,6 +14,7 @@ import java.util.UUID;
/** /**
* 字符串帮主类 * 字符串帮主类
*
* @author 颜佐光 * @author 颜佐光
*/ */
public class StringHelper { public class StringHelper {
...@@ -748,23 +749,22 @@ public class StringHelper { ...@@ -748,23 +749,22 @@ public class StringHelper {
* @return 加密后的字符串 * @return 加密后的字符串
*/ */
public static String md5(String string) { public static String md5(String string) {
byte[] hash = null;
try { try {
hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8")); byte[] hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10) {
hex.append("0");
}
hex.append(Integer.toHexString(b & 0xFF));
}
return hex.toString();
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
return StringHelper.EMPTY;
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10) {
hex.append("0");
}
hex.append(Integer.toHexString(b & 0xFF));
}
return hex.toString();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment