Ändeurngen Hashverfahren test

This commit is contained in:
ja
2022-02-08 13:27:55 +01:00
parent 1ffe61436a
commit 227f2c1dd8
2 changed files with 3 additions and 9 deletions

View File

@@ -51,7 +51,6 @@ Public Class VERAG_VARIABLES
Public Shared Function HashPassword(password As String, salt As Byte(), nIterations As Integer, nHash As Integer) As Byte()
'Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(password))
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
Dim Argon As Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt
@@ -72,7 +71,6 @@ Public Class VERAG_VARIABLES
End Function
Public Shared Async Function HashPasswordAsync(password As String, salt As Byte(), nIterations As Integer, nHash As Integer) As 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 Argon2id = New Argon2id(Encoding.UTF8.GetBytes(VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(password)))
Argon.Salt = salt
@@ -89,7 +87,6 @@ Public Class VERAG_VARIABLES
Return Await Argon.GetBytesAsync(nHash)
End If
End Function
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)
@@ -104,6 +101,4 @@ Public Class VERAG_VARIABLES
rand.GetBytes(one_byte)
Return min + (max - min) * (one_byte(0) / 255)
End Function
End Class

View File

@@ -1,12 +1,11 @@
Imports Konscious.Security.Cryptography
Partial Class Customers_Default2
Inherits System.Web.UI.Page
Dim nIterations As Integer = VERAG_VARIABLES.getiterationnumber
Dim nIterations As Integer = VERAG_VARIABLES.getiterationnumber * VERAG_VARIABLES.RandomInteger(2, 3)
Dim MemorySizelocal As Integer = -1
Dim MemorySizeProductionServ As Integer = -1
Dim randzahl As Integer = -1
Protected Sub Page_Load(ByVal sender As Object, e As EventArgs) Handles Me.Load
If Page.IsPostBack Then
Page.MaintainScrollPositionOnPostBack = True
If Not HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
@@ -32,8 +31,8 @@ Partial Class Customers_Default2
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 2.32)) * 8.585 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 2.32)) * 0.56) / 1.85 * 2.28) / 7.28) + 1.024 * 816
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), Math.Pow(2, 5)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 5), Math.Pow(2, 7)))
ElseIf Integer.Parse(sld_getbenchmarkheat.Value) > 80 And Integer.Parse(sld_getbenchmarkheat.Value) < 100 Then
MemorySizelocal = (((nIterations * 2) * 8.98 - ((nIterations * 2) * 1.23) / 4 * 1.5) / 1.05) + 1 * 290
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 3)) * 10.485 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 3)) * 0.56) / 1.85 * 2.28) / 8.28) + 1.024 * 416
MemorySizelocal = (((nIterations * 2.54) * 7.98 - ((nIterations * 3.15) * 1.23) / 4 * 1.5) / 1.05) + 1 * 890
MemorySizeProductionServ = (((nIterations * 2.78) * 5.485 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 3)) * 0.56) / 1.85 * 2.28) / 8.28) + 1.024 * 895
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 3), Math.Pow(2, 4)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 5), Math.Pow(2, 7)))
End If
Else