.NETやっぱり便利
たったこれだけ
sha256test.cs
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
class Program
{
[STAThread]
static void Main(string[] args)
{
if (args.Length == 0) { return; }
byte[] byteValue = File.ReadAllBytes(args[0]);
SHA256 crypto = new SHA256CryptoServiceProvider();
byte[] hashValue = crypto.ComputeHash(byteValue);
Console.WriteLine( String.Join("", hashValue.Select(x=>x.ToString("x2")).ToArray()) );
}
}
動確
下記のzipに対してSHA256一致確認済み。
https://www.ruby-lang.org/ja/news/2019/10/02/ruby-2-4-9-released/
>sha256test ruby-2.4.9.zip
4ad1c32554319661f2872bb978ff2cd520bc4593681a6476b4c5e7f330172d8b