在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
JAVA写法 public static String md5Base64(final String str, final String key) throws Exception { if ((null == str) || "".equals(str)) { return ""; } MessageDigest messagedigest; messagedigest = MessageDigest.getInstance("MD5"); String data = str; if ((null != key) && !"".equals(key)) { data += key; } messagedigest.update(data.getBytes("UTF-8")); byte[] baseStr = Base64.encodeBase64(messagedigest.digest()); return new String(baseStr); }
C#写法 public static string Md5tobase64(string logistics_interface) { MD5CryptoServiceProvider D = new MD5CryptoServiceProvider(); string str1 = logistics_interface; byte[] result = D.ComputeHash(System.Text.UnicodeEncoding.GetEncoding("UTF-8").GetBytes(str1)); return Convert.ToBase64String(result); }
php写法 base64_encode(hex2bin(md5($send_data .$send_key ))) python写法 # 签名MD5+base64 def get_data_digest(params): m = hashlib.md5() m.update(params.encode("utf8")) data_digest = m.digest() data_digest = base64.b64encode(data_digest).decode() return data_digest
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论