Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

KeyedHashAlgorithm: Utilisation de la méthode ‘KeyedHashAlgorithm.Create(HMACSHA1″)’ sur un Stream”

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

using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;
class ExKeyedHashAlgorithm
 {
    public static void Main(string[] args)
	{
        byte[] clé = Encoding.Unicode.GetBytes(@"Area = u03A0r^2");
 
        using (KeyedHashAlgorithm AlgoHash = KeyedHashAlgorithm.Create("HMACSHA1"))
		{
            AlgoHash.Key = clé;
 
            using (Stream fichier = new FileStream(@"c:teste.txt", FileMode.Open, FileAccess.Read))
			{
                byte[] hash = AlgoHash.ComputeHash(fichier);
 
                Console.WriteLine(BitConverter.ToString(hash));
            }
        }
    }
}

No comments yet.

Leave a Comment