using System;
using System.IO;
using System.Security.Cryptography;
static class MainClass
{
static void Main(string[] args)
{
// Create the hashing object.
using (HashAlgorithm hashAlg = HashAlgorithm.Create())
{
using (FileStream fsA = new FileStream("c:\\test.txt", FileMode.Open),
fsB = new FileStream("c:\\test1.txt", FileMode.Open)){
// Calculate the hash for the files.
byte[] hashBytesA = hashAlg.ComputeHash(fsA);
byte[] hashBytesB = hashAlg.ComputeHash(fsB);
// Compare the hashes.
if (BitConverter.ToString(hashBytesA) == BitConverter.ToString(hashBytesB))
{
Console.WriteLine("Files match.");
} else {
Console.WriteLine("No match.");
}
}
}
}
}
http://www.java2s.com/Tutorial/CSharp/CatalogCSharp.htm
C# / CSharp Tutorial
'App' 카테고리의 다른 글
Mybatis 사용법 - foreach문 사용 (파라미터: table) (0) | 2022.10.05 |
---|---|
정규식 (0) | 2020.11.19 |
how-to-create-thumbnail-of-video-using-c (0) | 2010.06.11 |
C# Sample Codes and Examples .. using media handler pro (0) | 2010.06.01 |
[wpf]only numeric input allow at textbox (0) | 2010.02.24 |