Änderungen dass Async-Funktionen wieder synchron laufen. Das ändert nichts an geschwidnigkeit da es eh schon lanes in argon2 gibt, welche mehr Kerne oder threads zur Hasung benutzen.
This commit is contained in:
@@ -139,7 +139,7 @@ Public Class TestPerformance
|
||||
Dim pw As String = "q~^Vd$fS§§nS4!q"
|
||||
For zahl As Integer = 0 To zahlint
|
||||
sw2.Start()
|
||||
hashbytes.Add(Await VERAG_VARIABLES.HashPassword(pw, arrkeys(zahl), arrzahl_iterats(zahl), arrzahl(zahl)))
|
||||
hashbytes.Add(VERAG_VARIABLES.HashPassword(pw, arrkeys(zahl), arrzahl_iterats(zahl), arrzahl(zahl)))
|
||||
sw2.Stop()
|
||||
arrzeitp2.Add(sw2.ElapsedMilliseconds)
|
||||
sw2.Reset()
|
||||
|
||||
@@ -27,7 +27,7 @@ Public Class VERAG_VARIABLES
|
||||
Return saltBytes
|
||||
'Convert.ToBase64String(saltBytes)
|
||||
End Function
|
||||
Public Shared Async Function HashPassword(password As String, salt As Byte(), nIterations As Integer, nHash As Integer) As Threading.Tasks.Task(Of Byte())
|
||||
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
|
||||
@@ -35,27 +35,27 @@ Public Class VERAG_VARIABLES
|
||||
Argon.Salt = salt
|
||||
Argon.DegreeOfParallelism = 24
|
||||
Argon.Iterations = nIterations
|
||||
Argon.MemorySize = (((nIterations * 1 - (nIterations * 1.23) / 4 * 2) / 1.05) + 1 * 160)
|
||||
Argon.MemorySize = (((nIterations * 1 - (nIterations * 1.23) / 4 * 2) / 1.05) + 1 * 270)
|
||||
|
||||
'Return Convert.ToBase64String(Argon.GetBytes(nHash))
|
||||
'Return Argon.GetBytes(nHash)
|
||||
'Dim saltBytes = Convert.FromBase64String(salt)
|
||||
'Using rfc2898DeriveBytes = New Rfc2898DeriveBytes(password, saltBytes, nIterations)
|
||||
'End Using
|
||||
Return Await Argon.GetBytesAsync(nHash)
|
||||
Return Argon.GetBytes(nHash)
|
||||
Else
|
||||
Dim Argon As Argon2d = New Argon2d(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
|
||||
Argon.Salt = salt
|
||||
Argon.DegreeOfParallelism = 48
|
||||
Argon.Iterations = nIterations * 1.375
|
||||
Argon.MemorySize = (((nIterations * 1.375 - (nIterations * 1.2) / 1.95 * 2.28) / 0.08) + 1 * 256) / 2
|
||||
Return Await Argon.GetBytesAsync(nHash)
|
||||
Argon.Iterations = nIterations * 2
|
||||
Argon.MemorySize = (((nIterations * 1.385 - (nIterations * 0.72) / 1.95 * 2.28) / 0.08) + 1 * 316)
|
||||
Return Argon.GetBytes(nHash)
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Async Function Verifyhash(ByVal passw As String, ByVal salt As Byte(), ByVal hash As Byte(), ByVal nIterations As Integer, ByVal nHash As Integer) As Threading.Tasks.Task(Of Boolean)
|
||||
Dim newHash As Byte() = Await HashPassword(passw, salt, nIterations, nHash)
|
||||
Public Shared Function Verifyhash(ByVal passw As String, ByVal 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)
|
||||
End Function
|
||||
Public Shared Function RandomInteger(ByVal min As Integer, ByVal max As Integer) As Integer
|
||||
|
||||
Reference in New Issue
Block a user