跪求C#或VB.NET数据验签测试,算法:SHA-1 就是在.NET环境下如何:算法一:加载公钥,算法二验证用:SHA-1签名过的数据的验签算法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 .NET 自己带的有把 /// <summary> /// 获取SHA1 /// </summary> /// <param name="p_Bytes">基本数据</param> /// <param name="p_StarIndex">开始位置</param> /// <param name="p_Count">数量</param> /// <returns>SHA1码</returns> private string GetInfoSHA1(byte[] p_Bytes, int p_StarIndex, int p_Count) { System.IO.MemoryStream _KeyMemory = new System.IO.MemoryStream(p_Bytes, p_StarIndex, p_Count); byte[] _InfoBytes = new byte[_KeyMemory.Length]; _KeyMemory.Read(_InfoBytes, 0, _InfoBytes.Length); _KeyMemory.Close(); System.Security.Cryptography.SHA1CryptoServiceProvider _SHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] ShaData = _SHA1.ComputeHash(_InfoBytes); string _ReturnSH1 = ""; for (int i = 0; i != ShaData.Length; i++) { _ReturnSH1 += ShaData[i].ToString("X02"); } return _ReturnSH1; } .NET 自己带的有把 /// <summary> /// 获取SHA1 /// </summary> /// <param name="p_Bytes">基本数据</param> /// <param name="p_StarIndex">开始位置</param> /// <param name="p_Count">数量</param> /// <returns>SHA1码</returns> private string GetInfoSHA1(byte[] p_Bytes, int p_StarIndex, int p_Count) { System.IO.MemoryStream _KeyMemory = new System.IO.MemoryStream(p_Bytes, p_StarIndex, p_Count); byte[] _InfoBytes = new byte[_KeyMemory.Length]; _KeyMemory.Read(_InfoBytes, 0, _InfoBytes.Length); _KeyMemory.Close(); System.Security.Cryptography.SHA1CryptoServiceProvider _SHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] ShaData = _SHA1.ComputeHash(_InfoBytes); string _ReturnSH1 = ""; for (int i = 0; i != ShaData.Length; i++) { _ReturnSH1 += ShaData[i].ToString("X02"); } return _ReturnSH1; } 正则 IsMatch 捕获物理层多播包 一个图像处理功能,大家看看用.net是否能实现? 网络拓扑已知,如何通过编程来定位网络故障? groupbox焦点问题 如何取得一个比指定小数大的最小整数 datagridview右键功能的实现 C#中怎么使用Real Play Active control Library? 一个很简单的WPF控件WebBrowser问题 C#监听端口的windows服务,有点疑问请大家来看看,有代码框架,马上给分!~~ 关于C#线程间访问的问题,高手请帮忙看看! 用并口通信 编写方波程序
/// 获取SHA1
/// </summary>
/// <param name="p_Bytes">基本数据</param>
/// <param name="p_StarIndex">开始位置</param>
/// <param name="p_Count">数量</param>
/// <returns>SHA1码</returns>
private string GetInfoSHA1(byte[] p_Bytes, int p_StarIndex, int p_Count)
{
System.IO.MemoryStream _KeyMemory = new System.IO.MemoryStream(p_Bytes, p_StarIndex, p_Count);
byte[] _InfoBytes = new byte[_KeyMemory.Length];
_KeyMemory.Read(_InfoBytes, 0, _InfoBytes.Length);
_KeyMemory.Close();
System.Security.Cryptography.SHA1CryptoServiceProvider _SHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
byte[] ShaData = _SHA1.ComputeHash(_InfoBytes); string _ReturnSH1 = ""; for (int i = 0; i != ShaData.Length; i++)
{
_ReturnSH1 += ShaData[i].ToString("X02");
} return _ReturnSH1;
}
/// 获取SHA1
/// </summary>
/// <param name="p_Bytes">基本数据</param>
/// <param name="p_StarIndex">开始位置</param>
/// <param name="p_Count">数量</param>
/// <returns>SHA1码</returns>
private string GetInfoSHA1(byte[] p_Bytes, int p_StarIndex, int p_Count)
{
System.IO.MemoryStream _KeyMemory = new System.IO.MemoryStream(p_Bytes, p_StarIndex, p_Count);
byte[] _InfoBytes = new byte[_KeyMemory.Length];
_KeyMemory.Read(_InfoBytes, 0, _InfoBytes.Length);
_KeyMemory.Close();
System.Security.Cryptography.SHA1CryptoServiceProvider _SHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
byte[] ShaData = _SHA1.ComputeHash(_InfoBytes); string _ReturnSH1 = ""; for (int i = 0; i != ShaData.Length; i++)
{
_ReturnSH1 += ShaData[i].ToString("X02");
} return _ReturnSH1;
}