備忘録

備忘録

C# SHA1を計算させる

private string CalculateSHA1(string str)
{
  using (var sha1 = SHA1.Create())
  {
    var bs = sha1.ComputeHash(new UTF8Encoding().GetBytes(str));
    return BitConverter.ToString(bs).ToLower().Replace("-", "");
  }
}