MD5加密与解密算法代码
一字符串加密public static String GetMD5(string input)
{
System.Security.Cryptography.MD5CryptoServiceProvider x=newSystem.Security.Cryptography.MD5CryptoServiceProvider();byte[ ]bs =System.Text.Encoding.UTF8.GetBytes(input) ;bs =x.ComputeHash(bs) ;
System.Text.StringBuilder s =newSystem.Text.StringBuilder() ;foreach(byte b inbs)
{s.Append(b.ToString("x2") .ToLower()) ;
}returns.ToString() ;
}public static string GetMD5(string sDataIn)
{
MD5CryptoServiceProvider md5 = new
MD5CryptoServiceProvider() ;byte[ ] bytValue, bytHash;bytValue = System.Text.Encoding.UTF8.GetBytes(sDataIn) ;bytHash = md5.ComputeHash(bytValue) ;md5.Clear( ) ;string sTemp = "";for (int i = 0; i < bytHash.Length; i++)
{sTemp += bytHash[i] .ToString("X") .PadLeft(2, '0' );}return sTemp.ToLower() ;
}
二文件加密
/// <summary>
///计算文件MD5值
/// </summary>
/// <param name="str">需要计算的文件路径</param>
/// <returns>MD5值</returns>public static string MD5Value(String filepath)
{
MD5 md5 = new MD5CryptoServiceProvider();byte[ ] md5ch;using (FileStream fs = File.OpenRead(filepath) ){md5ch = md5.ComputeHash(fs) ;
}md5.Clear( ) ;string strMd5 = "";for (int i = 0; i < md5ch.Length - 1; i++)
{strMd5 += md5ch[i] .ToString("x") .PadLeft(2, '0' ) ;}return strMd5;
}
今天获得消息,vdsina上了AMD EPYC系列的VDS,性价比比较高,站长弄了一个,盲猜CPU是AMD EPYC 7B12(经过咨询,详细CPU型号是“EPYC 7742”)。vdsina,俄罗斯公司,2014年开始运作至今,在售卖多类型VPS和独立服务器,可供选择的有俄罗斯莫斯科datapro和荷兰Serverius数据中心。付款比较麻烦:信用卡、webmoney、比特币,不支持PayPal...
pacificrack官方在搞2021年七夕促销,两款便宜vps给的配置都是挺不错的,依旧是接入1Gbps带宽,KVM虚拟、纯SSD raid10阵列,支持包括Linux、Windows 7、10、server2003、2008、2012、2016、2019在内多种操作系统。本次促销的VPS请特别注意限制条件,见本文末尾!官方网站:https://pacificrack.com支持PayPal、支...
关于半月湾HMBCloud商家之前也有几篇那文章介绍过这个商家的产品,对于他们家的其他产品我都没有多加留意,而是对他们家的DC5机房很多人还是比较喜欢的,这个比我们有些比较熟悉的某商家DC6 DC9机房限时,而且半月湾HMBCloud商家是相对便宜的。关于半月湾DC5机房的方案选择和介绍:1、半月湾三网洛杉矶DC5 CN2 GIA同款DC6 DC9 1G内存 1TB流量 月$4.992、亲测选择半...