Hashfunktion und Saltgenerierung funktionieren wieder wie angenommen.
This commit is contained in:
12
App_Code/LinkFactory.vb
Normal file
12
App_Code/LinkFactory.vb
Normal file
@@ -0,0 +1,12 @@
|
||||
Imports System.Threading.Tasks
|
||||
Imports Microsoft.VisualBasic
|
||||
|
||||
Public Class LinkFactory
|
||||
Public Shared Async Function createLink(link As String, par1 As String, par2 As String, par3 As String) As Threading.Tasks.Task(Of String)
|
||||
Dim factorymain As StringBuilder = New StringBuilder(link)
|
||||
factorymain.AppendFormat("?P1={1}&P2={2}", par1, par2, par3)
|
||||
Dim result As String = factorymain.ToString
|
||||
Await Task.Delay(2)
|
||||
Return result
|
||||
End Function
|
||||
End Class
|
||||
@@ -117,7 +117,6 @@ Public Class TestPerformance
|
||||
Public Shared finalzeit As Long
|
||||
|
||||
Public Shared Function TestHashrateServer(zahlint As Integer) As Byte()
|
||||
Dim arrkeys As New List(Of Byte())
|
||||
Dim arrzahl As New List(Of Integer)
|
||||
Dim arrzahl_iterats As New List(Of Integer)
|
||||
Dim hashbytes As New List(Of Byte())
|
||||
@@ -125,12 +124,13 @@ Public Class TestPerformance
|
||||
Dim arrzeitp2 As New List(Of Long)
|
||||
Dim arrzeitp3 As New List(Of Long)
|
||||
Dim finalarr As New List(Of Byte())
|
||||
Dim hashsalts As New List(Of Byte())
|
||||
Dim sw1 As Stopwatch = New Stopwatch
|
||||
Dim sw2 As Stopwatch = New Stopwatch
|
||||
Dim finalhash As Byte()
|
||||
For zahl As Integer = 0 To zahlint
|
||||
sw1.Start()
|
||||
arrkeys.Add(VERAG_VARIABLES.GenerateSalt(zahlint))
|
||||
hashsalts.Add(VERAG_VARIABLES.GenerateSalt(arrzahl(zahl)))
|
||||
arrzahl_iterats.Add(VERAG_VARIABLES.getiterationnumber)
|
||||
arrzahl.Add(zahlint)
|
||||
sw1.Stop()
|
||||
@@ -140,7 +140,7 @@ Public Class TestPerformance
|
||||
Dim pw As String = "qV64nS4"
|
||||
For zahl As Integer = 0 To zahlint
|
||||
sw2.Start()
|
||||
hashbytes.Add(VERAG_VARIABLES.HashPassword(pw, arrkeys(zahl), arrzahl_iterats(zahl), arrzahl(zahl)))
|
||||
hashbytes.Add(VERAG_VARIABLES.HashPassword(pw, hashsalts(zahl), arrzahl_iterats(zahl), arrzahl(zahl)))
|
||||
sw2.Stop()
|
||||
arrzeitp2.Add(sw2.ElapsedMilliseconds)
|
||||
sw2.Reset()
|
||||
|
||||
@@ -4,7 +4,7 @@ Imports Konscious.Security.Cryptography
|
||||
Public Class VERAG_VARIABLES
|
||||
Public Shared errornumb As Integer = 0
|
||||
Shared Function getiterationnumber() As Integer
|
||||
Return RandomInteger(Math.Pow(2, 4), Math.Pow(2, 11))
|
||||
Return RandomInteger(Math.Pow(2, 4), Math.Pow(2, 10))
|
||||
End Function
|
||||
|
||||
Shared Sub initerrorcount()
|
||||
@@ -31,25 +31,25 @@ Public Class VERAG_VARIABLES
|
||||
'Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(password))
|
||||
|
||||
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
||||
Dim Argon As Argon2d = New Argon2d(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.DegreeOfParallelism = 24
|
||||
Argon.Iterations = nIterations
|
||||
Argon.MemorySize = (((nIterations * 1.18 - (nIterations * 1.23) / 4 * 2) / 1.05) + 1 * 270)
|
||||
Argon.Iterations = nIterations * 2
|
||||
Argon.MemorySize = (((nIterations * 2.98 - (nIterations * 1.23) / 4 * 1.5) / 1.05) + 1 * 290)
|
||||
|
||||
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 = 36
|
||||
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
|
||||
Argon.Salt = GenerateSalt(nHash)
|
||||
Argon.DegreeOfParallelism = 48
|
||||
Argon.Iterations = nIterations * 3
|
||||
Argon.MemorySize = (((nIterations * 1.385 - (nIterations * 0.56) / 1.95 * 2.28) / 5.18) + 1.024 * 316)
|
||||
Argon.MemorySize = (((nIterations * 2.485 - (nIterations * 0.56) / 1.85 * 2.28) / 5.18) + 1.024 * 416)
|
||||
Return Argon.GetBytes(nHash)
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
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
|
||||
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)
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user