Algorithme de hachage: Utilisation de la méthode ‘create(SHA1″)’ sur un Stream”

Author:

Exemple,d'utilisation,de,'PermissionSet'
{filelink=17841}

using System;
using System.IO;
using System.Security.Cryptography;

class ExHashAlgorithm {
    public static void Main(string[] args)
    {
        using (HashAlgorithm AlgHash = HashAlgorithm.Create("SHA1"))
        {
            using (Stream fichier = new FileStream(@"c:test.txt", FileMode.Open, FileAccess.Read))
            {
                byte[] hash = AlgHash.ComputeHash(fichier);

                Console.WriteLine(BitConverter.ToString(hash));
            }
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *