MD5 Hash token Generation wurde implementiert.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports System.Security.Cryptography
|
||||
Imports Microsoft.VisualBasic
|
||||
|
||||
Public Class VERAG_VARIABLES
|
||||
Public Shared errornumb As Integer = 0
|
||||
@@ -14,4 +15,20 @@ Public Class VERAG_VARIABLES
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user