You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.bfd.qanda.utils;
import java.security.MessageDigest;
/** * 其他工具类 * @author jian.mao * @date 2023年9月19日 * @description */ public class OtherUtils {
public static String getMd5(String string) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); byte[] bs = md5.digest(string.getBytes("UTF-8")); StringBuilder sb = new StringBuilder(40); for (byte x : bs) { if ((x & 0xff) >> 4 == 0) { sb.append("0").append(Integer.toHexString(x & 0xff)); } else { sb.append(Integer.toHexString(x & 0xff)); } } return sb.toString(); } catch (Exception e) {
return "nceaform" + System.currentTimeMillis(); } } }
|