1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
using System.Security.Cryptography;
...
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
DES.Key = ASCIIEncoding.ASCII.GetBytes("Ta clef");
DES.IV = ASCIIEncoding.ASCII.GetBytes("Ta clef");
ICryptoTransform desencrypt = DES.CreateEncryptor();
MemoryStream encode = new MemoryStream();
CryptoStream encodeur = new CryptoStream(encode, DES.CreateEncryptor(), CryptoStreamMode.Write);
encodeur.Write(encbuff, 0, encbuff.Length);
encodeur.FlushFinalBlock();
byte[] result = encode.ToArray();
encodeur.Close();
encode.Close(); |
Partager