Commit 7bf01732 by songxiang

长短链接优化

parent 995f2e1c
...@@ -10,8 +10,6 @@ import org.slf4j.LoggerFactory; ...@@ -10,8 +10,6 @@ import org.slf4j.LoggerFactory;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
/** /**
* MD5 * MD5
*/ */
...@@ -66,9 +64,22 @@ public class MD5 { ...@@ -66,9 +64,22 @@ public class MD5 {
else else
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i])); md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
} }
return md5StrBuff.toString().toUpperCase(); return md5StrBuff.toString();
} }
/**
* MD5字符串,全大写
*
* @param str
* @return
*/
public static String getMD5StrUpper(String str) {
if (StringUtil.isEmpty(str)) {
return str;
}
return getMD5Str(str).toUpperCase();
}
/** /**
* MD5字符串,全小写 * MD5字符串,全小写
* *
...@@ -111,9 +122,9 @@ public class MD5 { ...@@ -111,9 +122,9 @@ public class MD5 {
return md5StrBuff.toString().toUpperCase(); return md5StrBuff.toString().toUpperCase();
} }
public static void main(String[] args){ public static void main(String[] args) {
System.out.println(MD5.getMD5Str("chenjianhua")); System.out.println(MD5.getMD5Str("chenjianhua"));
System.out.println(DigestUtils.md5Hex("chenjianhua").toUpperCase()); System.out.println(DigestUtils.md5Hex("chenjianhua").toUpperCase());
} }
} }
This diff is collapsed. Click to expand it.
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