问题描述
- 有会 C# 转 Java 代码么,求教如下代码。谢谢
-
public static string Sign(string prestr, string key, string _input_charset)
{
StringBuilder sb = new StringBuilder(32);prestr = prestr + key; MD5 md5 = new MD5CryptoServiceProvider(); byte[] t = md5.ComputeHash(Encoding.GetEncoding(_input_charset).GetBytes(prestr)); for (int i = 0; i < t.Length; i++) { sb.Append(t[i].ToString("x").PadLeft(2, '0')); } return sb.ToString(); }
时间: 2024-12-20 14:29:26