salut
j'ai un ptit pb au niveau du cryptage DES
j'ai trouver comment crypter en DES avec une cle de cryptage
seulement je me demande s'il y a un moyen d'obtenir en resultat que des caracteres alphanumeriques sans {/,+-}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 Public Shared Function EncryptTripleDES(ByVal sIn As String, ByVal sKey As String) As String Dim DES As New System.Security.Cryptography.TripleDESCryptoServiceProvider Dim hashMD5 As New System.Security.Cryptography.MD5CryptoServiceProvider ' scramble the key sKey = ScrambleKey(sKey) ' Compute the MD5 hash. DES.Key = hashMD5.ComputeHash(System.Text.Encoding.ASCII.GetBytes(sKey)) ' Set the cipher mode. DES.Mode = System.Security.Cryptography.CipherMode.ECB ' Create the encryptor. Dim DESEncrypt As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor() ' Get a byte array of the string. Dim Buffer As Byte() = System.Text.Encoding.ASCII.GetBytes(sIn) ' Transform and return the string. Return Convert.ToBase64String(DESEncrypt.TransformFinalBlock(Buffer, 0, Buffer.Length)) End Function
1000 merci
Partager