Änderung des ortes der Generierung der Random Zufallszahlen

This commit is contained in:
ja
2021-12-02 16:47:14 +01:00
parent eb4132384e
commit f25f943f5b

View File

@@ -523,12 +523,13 @@ Partial Class login_Change_PW
End If
End Sub
Function gensaltPassw(username As String, password As String, email As String, isnewSession As Boolean) As String
Dim intzahl = RandomInteger(Math.Pow(2, 8), Math.Pow(2, 12))
If isnewSession = False Then
Dim token As String
If String.IsNullOrEmpty(username) = False AndAlso String.IsNullOrEmpty(email) = False Then
If String.IsNullOrEmpty(password) = False Then
Try
Dim intzahl = RandomInteger(Math.Pow(2, 8), Math.Pow(2, 11))
Dim salt As String = VERAG_VARIABLES.GenerateSalt(intzahl)
Dim tok As String = password
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 1491, intzahl))
@@ -536,7 +537,7 @@ Partial Class login_Change_PW
tok = String.Empty
Return token
Catch Ex As Exception
Dim intzahl2 = RandomInteger(Math.Pow(2, 7), Math.Pow(2, 12))
'Dim Msg, Style, Title As String
'Msg = "Token Generation failed" & vbCrLf & "A new E-mail has been sent to the intern e-mail given."
'Style = vbRetry + vbExclamation + vbDefaultButton1
@@ -544,9 +545,9 @@ Partial Class login_Change_PW
'MsgBox(Msg, Style, Title)
'If MsgBox(Msg, Style, Title).Retry Then
'genToken(username, password, email)
Dim salt As String = VERAG_VARIABLES.GenerateSalt(intzahl2)
Dim salt As String = VERAG_VARIABLES.GenerateSalt(intzahl)
Dim tok As String = password
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 901, intzahl2))
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 901, intzahl))
salt = String.Empty
tok = String.Empty
Return token