Änderung Algorithus Hashing Geschwindigkeitsboost durch verkleinerung der Iterationenzahl.

This commit is contained in:
ja
2022-02-04 16:31:24 +01:00
parent 826b0a1953
commit e64734bd3a
2 changed files with 11 additions and 11 deletions

View File

@@ -56,7 +56,7 @@ Public Class VERAG_VARIABLES
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password))) Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt Argon.Salt = salt
Argon.DegreeOfParallelism = 8 Argon.DegreeOfParallelism = 8
Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(2, 3) Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(1, 2)
'Argon.MemorySize = (((nIterations * 19.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190) 'Argon.MemorySize = (((nIterations * 19.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190)
Argon.MemorySize = Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)).Length Argon.MemorySize = Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)).Length
Return Argon.GetBytes(nHash) Return Argon.GetBytes(nHash)
@@ -64,9 +64,8 @@ Public Class VERAG_VARIABLES
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password))) Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt Argon.Salt = salt
Argon.DegreeOfParallelism = 10 Argon.DegreeOfParallelism = 10
Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(2, 3) Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(1, 2)
'Argon.MemorySize = (((nIterations * 20.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190) Argon.MemorySize = (((nIterations * 20.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190)
Argon.MemorySize = Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)).Length
Return Argon.GetBytes(nHash) Return Argon.GetBytes(nHash)
End If End If
End Function End Function
@@ -77,7 +76,7 @@ Public Class VERAG_VARIABLES
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password))) Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt Argon.Salt = salt
Argon.DegreeOfParallelism = 8 Argon.DegreeOfParallelism = 8
Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(2, 3) Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(1, 2)
'Argon.MemorySize = (((nIterations * 19.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190) 'Argon.MemorySize = (((nIterations * 19.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190)
Argon.MemorySize = Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)).Length Argon.MemorySize = Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)).Length
Return Await Argon.GetBytesAsync(nHash) Return Await Argon.GetBytesAsync(nHash)
@@ -85,9 +84,8 @@ Public Class VERAG_VARIABLES
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password))) Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt Argon.Salt = salt
Argon.DegreeOfParallelism = 10 Argon.DegreeOfParallelism = 10
Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(2, 3) Argon.Iterations = nIterations * VERAG_VARIABLES.RandomInteger(1, 2)
'Argon.MemorySize = (((nIterations * 21.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190) Argon.MemorySize = (((nIterations * 21.98 - (nIterations * 10.23) / 14 * 2) / 4.058) + 1 * 190)
Argon.MemorySize = Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)).Length
Return Await Argon.GetBytesAsync(nHash) Return Await Argon.GetBytesAsync(nHash)
End If End If
End Function End Function
@@ -106,6 +104,4 @@ Public Class VERAG_VARIABLES
rand.GetBytes(one_byte) rand.GetBytes(one_byte)
Return min + (max - min) * (one_byte(0) / 255) Return min + (max - min) * (one_byte(0) / 255)
End Function End Function
End Class End Class

View File

@@ -22,7 +22,7 @@ Partial Class login_FLEX
Try Try
Dim teststr = String.Empty Dim teststr = String.Empty
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
intzahliterats = VERAG_VARIABLES.RandomInteger(Math.Pow(2, 8), Math.Pow(2, 17)) intzahliterats = VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), Math.Pow(2, 7))
teststr = Await TestPerformance.TestHashrateServerAsync(0.052 * VERAG_VARIABLES.GetCpuSpeed()) teststr = Await TestPerformance.TestHashrateServerAsync(0.052 * VERAG_VARIABLES.GetCpuSpeed())
Else Else
intzahliterats = VERAG_VARIABLES.RandomInteger(Math.Pow(2, 8), Math.Pow(2, 17)) intzahliterats = VERAG_VARIABLES.RandomInteger(Math.Pow(2, 8), Math.Pow(2, 17))
@@ -30,6 +30,10 @@ Partial Class login_FLEX
End If End If
If String.Equals(teststr, String.Empty) = False Then If String.Equals(teststr, String.Empty) = False Then
intzahliterats = VERAG_VARIABLES.getiterationnumber intzahliterats = VERAG_VARIABLES.getiterationnumber
teststr = Await TestPerformance.TestHashrateServerAsync(0.042 * VERAG_VARIABLES.GetCpuSpeed())
If String.Equals(teststr, String.Empty) = False Then
Response.Write("Der Webserver kann momentan keine sicherheitsrelevanten Aufgaben ausführen. Bitte versuchen Sie es später noch einmal.")
End If
End If End If
Catch Ex As SettingsPropertyNotFoundException Catch Ex As SettingsPropertyNotFoundException
VERAG_VARIABLES.seterrorcount(4534) VERAG_VARIABLES.seterrorcount(4534)