Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
chen | 9b2240cbd3 | 3 years ago |
chen | 43d91b09f1 | 3 years ago |
chen | cf7a4a3ee9 | 3 years ago |
chen | 5b7353f2b3 | 3 years ago |
yuqin | 0b532797cb | 4 years ago |
8 changed files with 45 additions and 13 deletions
@ -0,0 +1,31 @@ |
||||
package com.msdw.tms.util; |
||||
|
||||
import java.security.MessageDigest; |
||||
import java.security.NoSuchAlgorithmException; |
||||
|
||||
public final class MD5 { |
||||
|
||||
public static String encrypt(String strSrc) { |
||||
try { |
||||
char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', |
||||
'9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
||||
byte[] bytes = strSrc.getBytes(); |
||||
MessageDigest md = MessageDigest.getInstance("MD5"); |
||||
md.update(bytes); |
||||
bytes = md.digest(); |
||||
int j = bytes.length; |
||||
char[] chars = new char[j * 2]; |
||||
int k = 0; |
||||
for (int i = 0; i < bytes.length; i++) { |
||||
byte b = bytes[i]; |
||||
chars[k++] = hexChars[b >>> 4 & 0xf]; |
||||
chars[k++] = hexChars[b & 0xf]; |
||||
} |
||||
return new String(chars); |
||||
} catch (NoSuchAlgorithmException e) { |
||||
e.printStackTrace(); |
||||
throw new RuntimeException("MD5加密出错!!+" + e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,2 +1,2 @@ |
||||
#\u9009\u62E9\u6307\u5B9A\u73AF\u5883,\u76EE\u524D\u53EA\u6709\u6D4B\u8BD5\u548C\u6B63\u5F0F\u73AF\u5883 |
||||
spring.profiles.active=prod |
||||
spring.profiles.active=test |
Loading…
Reference in new issue