Serverseitiges Ändern wurde angefangen implementiert zu werden.

This commit is contained in:
ja
2021-12-16 11:52:00 +01:00
parent 0b7f25475c
commit 53843457f1
9 changed files with 213 additions and 163 deletions

View File

@@ -1,6 +1,7 @@
Imports System.Data.SqlClient
Imports System.Diagnostics
Imports Microsoft.VisualBasic
Imports Konscious.Security.Cryptography
Public Class TestPerformance
@@ -130,7 +131,7 @@ Public Class TestPerformance
sw1.Start()
arrkeys.Add(VERAG_VARIABLES.GenerateSalt(VERAG_VARIABLES.RandomInteger(0, zahlint)))
arrzahl_iterats.Add(VERAG_VARIABLES.getiterationnumber)
arrzahl.Add(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 10), Math.Pow(2, 14))))
arrzahl.Add(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 6), Math.Pow(2, 10))))
sw1.Stop()
arrzeitp1.Add(sw1.ElapsedMilliseconds)
sw1.Reset()

View File

@@ -29,26 +29,29 @@ Public Class VERAG_VARIABLES
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())
'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)))
Argon.Salt = salt
Argon.DegreeOfParallelism = 24
Argon.Iterations = nIterations
Argon.MemorySize = (((nIterations * 1 - nIterations / 4 * 2) / 1.05) + 1 * 150)
Return Await Argon.GetBytesAsync(nHash)
'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)
Else
Dim Argon As Argon2d = New Argon2d(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt
Argon.DegreeOfParallelism = 48
Argon.DegreeOfParallelism = 36
Argon.Iterations = nIterations
Argon.MemorySize = ((((nIterations * 3 - nIterations / 1.95 * 2.28) / 0.08) + 1 * 256) / 2)
Argon.MemorySize = ((((nIterations * 4 - nIterations / 1.95 * 2.28) / 0.08) + 1 * 256) / 2)
Return Await Argon.GetBytesAsync(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)

View File

@@ -150,4 +150,21 @@ Public Class WebService
myConn.Close() : Return lstCountries
End Function
<WebMethod()>
Private Function buildtablerow(page As Page, tbl As Table) As Table
Dim row As TableRow = New TableRow
Dim c1 As TableCell = New TableCell
Dim c2 As TableCell = New TableCell
Dim c3 As TableCell = New TableCell
c1.Text = "ID"
c2.Text = "Stadt"
c3.Text = "Persona"
row.Cells.Add(c1)
row.Cells.Add(c2)
row.Cells.Add(c3)
tbl.Rows.Add(row)
Return tbl
End Function
End Class