Änderungen

This commit is contained in:
ja
2021-12-15 11:23:00 +01:00
parent a689d48aa6
commit 94c7c5fd99
5 changed files with 168 additions and 106 deletions

View File

@@ -1,8 +1,10 @@
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports System.Diagnostics
Imports Microsoft.VisualBasic Imports Microsoft.VisualBasic
Public Class TestPerformance Public Class TestPerformance
Public Shared zeitspannefürtest As Long
Public Shared Sub createnUsers(ByRef n As Integer) Public Shared Sub createnUsers(ByRef n As Integer)
Dim ConnectionString = "" Dim ConnectionString = ""
@@ -109,5 +111,54 @@ Public Class TestPerformance
End Using End Using
End Sub End Sub
Public Shared DeleteUsers() Public Shared Sub DeleteUsers()
End Sub
Public Shared Async Function TestSaltHashRateMax(z As Integer) As Threading.Tasks.Task(Of Byte())
Dim timespan As Long = New Long()
Dim timespan2 As Long = New Long()
Dim Bytearr As List(Of Byte()) = New List(Of Byte())
Dim pwarr As List(Of Byte()) = New List(Of Byte())
Dim pwselectedindex As Integer = -1
For ztemp As Integer = 0 To z
Bytearr.Add(VERAG_VARIABLES.GenerateSalt(z))
Next
For ztemp As Integer = 0 To z
Dim timer1 As Stopwatch = New Stopwatch
timer1.Start()
If timer1.IsRunning = True Then
Bytearr.Add(VERAG_VARIABLES.GenerateSalt(z))
Dim iteras As Integer = VERAG_VARIABLES.getiterationnumber()
Dim intz As Integer = VERAG_VARIABLES.RandomInteger(0, z)
Dim Passw As String = "XFV2ctdhB5G*S!r"
pwarr.Add(Await VERAG_VARIABLES.HashPassword(Passw, Bytearr.Item(z), iteras, intz))
End If
timer1.Stop()
timespan = timer1.ElapsedMilliseconds
Dim timer2 As Stopwatch = New Stopwatch
timer2.Start()
If timer2.IsRunning = True Then
Bytearr.Add(VERAG_VARIABLES.GenerateSalt(z))
Dim iteras As Integer = VERAG_VARIABLES.getiterationnumber()
Dim intz As Integer = VERAG_VARIABLES.RandomInteger(0, z)
Dim Passw As String = "XFV2ctdhB5G*S!r"
pwarr.Add(Await VERAG_VARIABLES.HashPassword(Passw, Bytearr.Item(z), iteras, intz))
End If
timer2.Stop()
timespan2 = timer2.ElapsedMilliseconds
If timespan2 < timespan Then
pwselectedindex = z
zeitspannefürtest = timespan2
ElseIf timespan < timespan2 Then
pwselectedindex = z
zeitspannefürtest = timespan
End If
Next
If Not pwselectedindex = -1 Then
Return Bytearr(pwselectedindex)
End If
End Function
End Class End Class

View File

@@ -1,4 +1,4 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Customers/Customers.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Customers_Default" %> <%@ Page Title="" Language="VB" MasterPageFile="~/Customers/Customers.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Customers_Default" Async="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content> </asp:Content>

View File

@@ -1,4 +1,4 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Customers/Customers.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Customers_Default2" %> <%@ Page Title="" Language="VB" MasterPageFile="~/Customers/Customers.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Customers_Default2" Async="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"><%If String.Equals(Page.User.Identity.Name, "Admin") = False Then <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"><%If String.Equals(Page.User.Identity.Name, "Admin") = False Then
FormsAuthentication.RedirectToLoginPage() FormsAuthentication.RedirectToLoginPage()
@@ -79,6 +79,8 @@
</tr> </tr>
<tr><td> <tr><td>
<tr><td><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td></tr> <tr><td><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td></tr>
<tr><td><asp:Button ID="Butn_TestHashrate" runat="server" OnClick="Butn_TestHashrate_ClickAsync" BackColor="WhiteSmoke" Text="Test the Hashrate of the Server"/></td></tr>
<tr><td><asp:Label ID="lbl_resulttesthashrate" runat="server" ClientIDMode="AutoID">Hier wird das Ergebnis angezeigt!</asp:Label></td></tr>
</table> </table>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>

View File

@@ -1,7 +1,7 @@
 
Partial Class Customers_Default2 Partial Class Customers_Default2
Inherits System.Web.UI.Page Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, e As EventArgs) Handles Me.Load Protected Async Sub Page_Load(ByVal sender As Object, e As EventArgs) Handles Me.Load
If Page.IsPostBack Then If Page.IsPostBack Then
Page.MaintainScrollPositionOnPostBack = True Page.MaintainScrollPositionOnPostBack = True
@@ -33,4 +33,12 @@ Partial Class Customers_Default2
txt_Fehlercodezuzahl.Text = finalstr txt_Fehlercodezuzahl.Text = finalstr
End If End If
End Sub End Sub
Protected Async Function Butn_TestHashrate_ClickAsync(sender As Object, e As EventArgs) As Threading.Tasks.Task
Dim ztemp As Byte() = Await TestPerformance.TestSaltHashRateMax(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 10), Math.Pow(2, 14)))
lbl_resulttesthashrate.ForeColor = Drawing.Color.GreenYellow
lbl_resulttesthashrate.Text = "Successful Test with: " + Convert.ToBase64String(ztemp) + "in der zeit: " + Space(2) + TimeSpan.FromMilliseconds(TestPerformance.zeitspannefürtest).Milliseconds.ToString
End Function
End Class End Class

View File

@@ -6,7 +6,8 @@
<head> <head>
<%@ import Namespace="MySql.Data.MySqlClient" %> <%@ import Namespace="MySql.Data.MySqlClient" %>
<script runat="server"> <script runat="server">
Sub Page_Load() Handles Me.Load Overloads Sub Page_Load() Handles Me.Load
' MsgBox ("test") ' MsgBox ("test")
'Dim con As New MySqlConnection 'Dim con As New MySqlConnection
'Dim cmd As New MySqlCommand 'Dim cmd As New MySqlCommand