C# SHA256 hash helper
来源:互联网 发布:淘宝不搜血滴子 编辑:程序博客网 时间:2024/05/17 01:59
public class SHAHelper { public static string HashStringSHA2(params string[] inputString) { string val = inputString.Aggregate("", (current, s) => current + s); return HashString(val, "SHA256"); } public static string HashString(string inputString, string hashName) { HashAlgorithm algorithm = HashAlgorithm.Create(hashName); if (algorithm == null) { throw new ArgumentException("Unrecognized hash name", "hashName"); } byte[] hash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); return Convert.ToBase64String(hash); } public static bool IsSameSHA2(string hashCode, params string[] inputString) { if (string.IsNullOrWhiteSpace(hashCode)) { return false; } return hashCode.Equals(HashStringSHA2(inputString), StringComparison.OrdinalIgnoreCase); } }
1 0
- C# SHA256 hash helper
- MD5, SHA1, SHA256 and SHA512 Hash Algorithm Functions in C#
- C#加密算法HmacSHA256,SHA256
- C# 文件加密解密 SHA256
- C# XML helper
- c# XML Helper
- C#压缩解压Helper
- C# MySQL Helper
- sha256
- sha256
- Windows store app Hash(MD5/SHA1/SHA256/SHA384/SHA512)
- guava:计算hash(md5,sha256,crc...)真是方便
- SQLite Helper Library For C#
- C#异步执行操作Helper
- C#通用类Helper整理
- Helper
- c# IE插件 Browser Helper Object (BHO)
- C#压缩解压文件及文件夹Helper
- 理解Java中的IO
- Android-《Managing Audio Playback》
- LVQ学习向量量化网络
- 文字大小的设置
- Spring学习第三天:配置Bean-1
- C# SHA256 hash helper
- php的unset()与引用
- Struts2.0学习笔记 --- 访问或添加几个属性的三种方式
- C# 一些获取硬件参数的方法
- 课本例题3-2==彩票中奖
- Context都没弄明白,还怎么做Android开发?
- Python字典内置函数和方法
- 237. Delete Node in a Linked List
- 浅谈单片机应用程序架构