Csharp/C Sharp/Security/HashAlgorithm — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 14:38, 26 мая 2010

HashAlgorithm: Create()

<source lang="csharp">

using System; using System.IO; using System.Security.Cryptography; class MainClass {

   public static void Main(string[] args) {
       using (HashAlgorithm hashAlg = HashAlgorithm.Create(args[0])) {
           using (Stream file = new FileStream(args[1], FileMode.Open, FileAccess.Read)) {
               byte[] hash = hashAlg.ruputeHash(file);
               Console.WriteLine(BitConverter.ToString(hash));
           }
       }
   }

}

</source>