Imports System.Security.Cryptography Imports System.IO Imports System.Text Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim monPass As String = "hello" 'Création de l'objet pour le hashage Dim sha As New SHA1CryptoServiceProvider() 'Hashage de la chaine de caractère Dim hashBytes() As Byte = sha.ComputeHash(Encoding.ASCII.GetBytes(monPass)) 'On peut même par la suite le convertir en une représentation sous forme de chaine de caractères qu'on pourra stocker cette fois dans un fichier Dim hashCode As String = "" For Each b As Byte In res hashCode &= b.ToString("X4") Next End Sub
Dim hashCode As String = "" For Each b As Byte In hashBytes hashCode &= b.ToString("X4") Next