Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

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

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));
            }
        }
    }
}

No comments yet.

Leave a Comment