Ändeurngen Hashverfahren test

This commit is contained in:
ja
2022-02-08 13:27:55 +01:00
parent 1ffe61436a
commit 227f2c1dd8
2 changed files with 3 additions and 9 deletions

View File

@@ -51,7 +51,6 @@ Public Class VERAG_VARIABLES
Public Shared Function HashPassword(password As String, salt As Byte(), nIterations As Integer, nHash As Integer) As Byte()
'Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(password))
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt
@@ -72,7 +71,6 @@ Public Class VERAG_VARIABLES
End Function
Public Shared Async Function HashPasswordAsync(password As String, salt As Byte(), nIterations As Integer, nHash As Integer) As Task(Of Byte())
'Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(password))
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt
@@ -89,7 +87,6 @@ Public Class VERAG_VARIABLES
Return Await Argon.GetBytesAsync(nHash)
End If
End Function
Public Shared Function Verifyhash(ByVal passw As String, salt As Byte(), ByVal hash As Byte(), ByVal nIterations As Integer, ByVal nHash As Integer) As Boolean
Dim newHash As Byte() = HashPassword(passw, salt, nIterations, nHash)
Return hash.SequenceEqual(newHash)
@@ -104,6 +101,4 @@ Public Class VERAG_VARIABLES
rand.GetBytes(one_byte)
Return min + (max - min) * (one_byte(0) / 255)
End Function
End Class