Imports System.Security.Cryptography Imports Microsoft.VisualBasic Public Class VERAG_VARIABLES Public Shared errornumb As Integer = 0 Shared Sub initerrorcount() errornumb = 0 End Sub Shared Sub seterrorcount(var As Integer) errornumb = var End Sub Shared Function geterrornumb() As String Return Environment.NewLine + "Error:" + Space(1) + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(errornumb.ToString) + Space(1) End Function Shared Function getErrorcodeindez(Errorcode As String) As String Return VERAG_PROG_ALLGEMEIN.cCryptography3.Decrypt(Errorcode) End Function Public Shared Function GenerateSalt(ByVal nSalt As Integer) As String Dim saltBytes = New Byte(nSalt) {} Using provider = New RNGCryptoServiceProvider() provider.GetNonZeroBytes(saltBytes) End Using Return Convert.ToBase64String(saltBytes) End Function Public Shared Function HashPassword(ByVal password As String, ByVal salt As String, ByVal nIterations As Integer, ByVal nHash As Integer) As String Dim saltBytes = Convert.FromBase64String(salt) Using rfc2898DeriveBytes = New Rfc2898DeriveBytes(password, saltBytes, nIterations) Return Convert.ToBase64String(rfc2898DeriveBytes.GetBytes(nHash)) End Using End Function End Class