/* ANY-LICENSE V1.0 ---------------- You can use these files under any license approved by the Open Source Initiative, preferrably one of the popular licenses, as long as the license you choose is compatible to the dependencies of these files. See http://www.opensource.org/licenses/ for a list of approved licenses. Author: Martin Furter Project: Modified: 2019 */ using System; using System.IO; using System.Security.Cryptography; public class Md5Sum { [STAThread] static public void Main( string[] args ) { foreach( string filename in args ) { md5sum( filename ); } } static void md5sum( string filename ) { var file = new FileStream( filename, FileMode.Open, FileAccess.Read ); var md5 = MD5.Create(); var cs = new CryptoStream( file, md5, CryptoStreamMode.Read ); var buffer = new byte[1024*1024]; while( file.Position < file.Length ) { cs.Read( buffer, 0, buffer.Length ); } string hash = BitConverter.ToString( md5.Hash ); hash = hash.Replace( "-", "" ).ToLower(); System.Console.WriteLine( "{0} {1}", hash, filename ); } }