public static string GetMd5Hash()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
var input= Convert.ToInt64(ts.TotalMilliseconds).ToString();
System.Security.Cryptography.MD5 md5Hash = System.Security.Cryptography.MD5.Create();
// 将输入字符串转换为字节数组并计算哈希数据
byte[] data = md5Hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(input));
// 创建一个 Stringbuilder 来收集字节并创建字符串
System.Text.StringBuilder sBuilder = new System.Text.StringBuilder();
// 循环遍历哈希数据的每一个字节并格式化为十六进制字符串
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString().Substring(0, 6);
}