Ä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:
@@ -27,7 +27,7 @@ Partial Class ForgotPW
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Async Sub btn_Send_Click(sender As Object, e As EventArgs)
|
||||
Protected Sub btn_Send_Click(sender As Object, e As EventArgs)
|
||||
Try
|
||||
Dim username As String = String.Empty
|
||||
Dim password As String = String.Empty
|
||||
@@ -215,7 +215,7 @@ Partial Class ForgotPW
|
||||
tokenname = Session.Item("TokenforEmail")
|
||||
End If
|
||||
Dim intzahl As Integer = VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), Math.Pow(2, 10))
|
||||
Dim hashdata As Byte() = Await VERAG_VARIABLES.HashPassword(tokenname, salt, VERAG_VARIABLES.getiterationnumber, intzahl)
|
||||
Dim hashdata As Byte() = VERAG_VARIABLES.HashPassword(tokenname, salt, VERAG_VARIABLES.getiterationnumber, intzahl)
|
||||
Session.Add("TokenHashtokenized", VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(Convert.ToBase64String(hashdata)))
|
||||
If SendEmail(username, password, email, tokenname, customerID, isusrnmright, isCustomeridright, isemailright, Session.IsNewSession, UserID) = True Then
|
||||
'password = RandomString(New Random, 10)
|
||||
@@ -609,7 +609,7 @@ Partial Class ForgotPW
|
||||
Async Function Findtokenhashsalt(username As String, password As String, email As String, customerID As String, isusernameright As Boolean, isuserIDright As Boolean, isuserEmailright As Boolean, isnewsess As Boolean, UserID As String) As Task(Of String)
|
||||
Dim t As Task(Of String)
|
||||
t = Task.Run(Async Function() As Task(Of String)
|
||||
Return Await gensaltToken(username, password, email, customerID, isusernameright, isuserIDright, isuserEmailright, isnewsess, UserID)
|
||||
Return gensaltToken(username, password, email, customerID, isusernameright, isuserIDright, isuserEmailright, isnewsess, UserID)
|
||||
End Function)
|
||||
Return Await t
|
||||
End Function
|
||||
@@ -758,7 +758,7 @@ Partial Class ForgotPW
|
||||
Return min + (max - min) * (one_byte(0) / 255)
|
||||
End Function
|
||||
|
||||
Async Function gensaltToken(username As String, password As String, email As String, CustomerID As String, isusrnmright As Boolean, iscstmIDright As Boolean, isemailright As Boolean, isnewSession As Boolean, theUserID As String) As Task(Of String)
|
||||
Function gensaltToken(username As String, password As String, email As String, CustomerID As String, isusrnmright As Boolean, iscstmIDright As Boolean, isemailright As Boolean, isnewSession As Boolean, theUserID As String) As String
|
||||
If isnewSession = False Then
|
||||
Dim time() As Byte = BitConverter.GetBytes(DateTime.UtcNow.ToBinary())
|
||||
Dim Key() As Byte = Guid.NewGuid().ToByteArray()
|
||||
@@ -771,9 +771,9 @@ Partial Class ForgotPW
|
||||
If isusrnmright = True And iscstmIDright = True And isemailright = True AndAlso String.IsNullOrEmpty(theUserID) = False Then
|
||||
|
||||
Dim salt As Byte() = VERAG_VARIABLES.GenerateSalt(intzahl)
|
||||
'Dim tok As Byte = Convert.ToBase64String(time.Concat(Key).ToArray())
|
||||
Dim tok As String = Convert.ToBase64String(time.Concat(Key).ToArray())
|
||||
token = Await VERAG_VARIABLES.HashPassword(tok, salt, intzahliterats, intzahl)
|
||||
'Dim tok As Byte = Convert.ToBase64String(time.Concat(Key).ToArray())
|
||||
Dim tok As String = Convert.ToBase64String(time.Concat(Key).ToArray())
|
||||
token = VERAG_VARIABLES.HashPassword(tok, salt, intzahliterats, intzahl)
|
||||
|
||||
Return Convert.ToBase64String(token)
|
||||
Else
|
||||
@@ -834,7 +834,7 @@ Partial Class ForgotPW
|
||||
Return sb.ToString()
|
||||
End Function
|
||||
|
||||
Protected Async Sub btn_Testmail_Click(sender As Object, e As EventArgs)
|
||||
Protected Sub btn_Testmail_Click(sender As Object, e As EventArgs)
|
||||
Dim username As String = "userwithlongername"
|
||||
Dim Passw As String = "Test1!W"
|
||||
Dim email As String = "ja@verag.ag"
|
||||
@@ -853,8 +853,8 @@ Partial Class ForgotPW
|
||||
Else
|
||||
tokentest = Session.Item("TokenforEmail")
|
||||
End If
|
||||
hashtoken = Await VERAG_VARIABLES.HashPassword(tokentest, salt, iterationnumb, nzahl)
|
||||
If Await VERAG_VARIABLES.Verifyhash(tokentest, salt, hashtoken, iterationnumb, nzahl) = True Then
|
||||
hashtoken = VERAG_VARIABLES.HashPassword(tokentest, salt, iterationnumb, nzahl)
|
||||
If VERAG_VARIABLES.Verifyhash(tokentest, salt, hashtoken, iterationnumb, nzahl) = True Then
|
||||
If SendEmail(username, Passw, email, tokentest, CustomerID, True, True, True, False, TheusrID) = True Then
|
||||
'password = RandomString(New Random, 10)
|
||||
If getDateoftoken(tokentest) = True Then
|
||||
|
||||
Reference in New Issue
Block a user