@@ -1,164 +1,113 @@
Imports System . Data . SqlClient
Imports System . Diagnostics
Imports Microsoft . VisualBasic
Public Class TestPerformance
Public Shared zeitspannefürtest As Long
Public Shared Sub createnUsers ( ByRef n As Integer )
Dim ConnectionString = " "
Public Shared Sub createnUsers ( ByRef n As Integer )
Dim ConnectionString = " "
If HttpContext . Current . Request . ServerVariables ( " SERVER_NAME " ) = " localhost " Then
VERAG_PROG_ALLGEMEIN . cAllgemein . TESTSYSTEM = True
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
ConnectionString = " Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$; "
Else
VERAG_PROG_ALLGEMEIN . cAllgemein . TESTSYSTEM = False
ConnectionString = " Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$; "
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
End If
If HttpContext . Current . Request . ServerVariables ( " SERVER_NAME " ) = " localhost " Then
VERAG_PROG_ALLGEMEIN . cAllgemein . TESTSYSTEM = True
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
ConnectionString = " Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$; "
Else
VERAG_PROG_ALLGEMEIN . cAllgemein . TESTSYSTEM = False
ConnectionString = " Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$; "
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
End If
Using con As New SqlConnection ( ConnectionString )
' Using cmd As New SqlCommand("Validate_User")
For nzahl As Integer = 0 To n Step 1
Dim UsrID As Integer = VERAG_VARIABLES . RandomInteger ( VERAG_VARIABLES . RandomInteger ( 0 , 15 ) , VERAG_VARIABLES . RandomInteger ( 500 , 45750 ) )
Dim usrname As String = String . Empty
Dim pw As String = " Pw " + Convert . ToBase64String ( VERAG_VARIABLES . GenerateSalt ( VERAG_VARIABLES . RandomInteger ( 0 , nzahl + 2 ) ) )
Dim email As String = " ja@verag.ag "
Using con As New SqlConnection ( ConnectionString )
' Using cmd As New SqlCommand("Validate_User")
For nzahl As Integer = 0 To n Step 1
Dim UsrID As Integer = VERAG_VARIABLES . RandomInteger ( VERAG_VARIABLES . RandomInteger ( 0 , 15 ) , VERAG_VARIABLES . RandomInteger ( 500 , 45750 ) )
Dim usrname As String = String . Empty
Dim pw As String = " Pw " + Convert . ToBase64String ( VERAG_VARIABLES . GenerateSalt ( VERAG_VARIABLES . RandomInteger ( 0 , nzahl + 2 ) ) )
Dim email As String = " ja@verag.ag "
Dim monthrndm As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 12 )
Dim Yearrand As Integer = VERAG_VARIABLES . RandomInteger ( 2001 , 2021 )
Dim dayrand As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 30 )
Dim datelastloggedin As Date = New Date ( Yearrand , monthrndm , dayrand )
Dim monthrndm2 As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 12 )
Dim Yearrand2 As Integer = VERAG_VARIABLES . RandomInteger ( 2001 , 2021 )
Dim dayrand2 As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 30 )
Dim DateCreate As Date = New Date ( Yearrand2 , monthrndm2 , dayrand2 )
Dim monthrndm As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 12 )
Dim Yearrand As Integer = VERAG_VARIABLES . RandomInteger ( 2001 , 2021 )
Dim dayrand As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 30 )
Dim datelastloggedin As Date = New Date ( Yearrand , monthrndm , dayrand )
Dim monthrndm2 As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 12 )
Dim Yearrand2 As Integer = VERAG_VARIABLES . RandomInteger ( 2001 , 2021 )
Dim dayrand2 As Integer = VERAG_VARIABLES . RandomInteger ( 1 , 30 )
Dim DateCreate As Date = New Date ( Yearrand2 , monthrndm2 , dayrand2 )
'Namen
Dim lstCapitals As New ArrayList
' Capital Names
lstCapitals . Add ( " Montgomery " )
lstCapitals . Add ( " Juneau " )
lstCapitals . Add ( " Phoenix " )
lstCapitals . Add ( " Little Rock " )
lstCapitals . Add ( " Sacramento " )
lstCapitals . Add ( " Denver " )
lstCapitals . Add ( " Hartford " )
lstCapitals . Add ( " Dover " )
lstCapitals . Add ( " Tallahassee " )
lstCapitals . Add ( " Atlanta " )
lstCapitals . Add ( " Honolulu " )
lstCapitals . Add ( " Boise " )
lstCapitals . Add ( " Springfield " )
lstCapitals . Add ( " Indianapolis " )
lstCapitals . Add ( " Des Moines " )
lstCapitals . Add ( " Topeka " )
lstCapitals . Add ( " Frankfort " )
lstCapitals . Add ( " Baton Rouge " )
lstCapitals . Add ( " Augusta " )
lstCapitals . Add ( " Annapolis " )
lstCapitals . Add ( " Boston " )
lstCapitals . Add ( " Lansing " )
lstCapitals . Add ( " St. Paul " )
lstCapitals . Add ( " Jackson " )
lstCapitals . Add ( " Jefferson City " )
lstCapitals . Add ( " Helena " )
lstCapitals . Add ( " Lincoln " )
lstCapitals . Add ( " Carson City " )
lstCapitals . Add ( " Concord " )
lstCapitals . Add ( " Trenton " )
lstCapitals . Add ( " Santa Fe " )
lstCapitals . Add ( " Albany " )
lstCapitals . Add ( " Raleigh " )
lstCapitals . Add ( " Bismarck " )
lstCapitals . Add ( " Columbus " )
lstCapitals . Add ( " Oklahoma City " )
lstCapitals . Add ( " Salem " )
lstCapitals . Add ( " Harrisburg " )
lstCapitals . Add ( " Providence " )
lstCapitals . Add ( " Columbia " )
lstCapitals . Add ( " Pierre " )
lstCapitals . Add ( " Nashville " )
lstCapitals . Add ( " Austin " )
lstCapitals . Add ( " Salt Lake City " )
lstCapitals . Add ( " Montpelier " )
lstCapitals . Add ( " Richmond " )
lstCapitals . Add ( " Olympia " )
lstCapitals . Add ( " Charleston " )
lstCapitals . Add ( " Madison " )
lstCapitals . Add ( " Cheyenne " )
'Namen
Dim lstCapitals As New ArrayList
' Capital Names
lstCapitals . Add ( " Montgomery " )
lstCapitals . Add ( " Juneau " )
lstCapitals . Add ( " Phoenix " )
lstCapitals . Add ( " Little Rock " )
lstCapitals . Add ( " Sacramento " )
lstCapitals . Add ( " Denver " )
lstCapitals . Add ( " Hartford " )
lstCapitals . Add ( " Dover " )
lstCapitals . Add ( " Tallahassee " )
lstCapitals . Add ( " Atlanta " )
lstCapitals . Add ( " Honolulu " )
lstCapitals . Add ( " Boise " )
lstCapitals . Add ( " Springfield " )
lstCapitals . Add ( " Indianapolis " )
lstCapitals . Add ( " Des Moines " )
lstCapitals . Add ( " Topeka " )
lstCapitals . Add ( " Frankfort " )
lstCapitals . Add ( " Baton Rouge " )
lstCapitals . Add ( " Augusta " )
lstCapitals . Add ( " Annapolis " )
lstCapitals . Add ( " Boston " )
lstCapitals . Add ( " Lansing " )
lstCapitals . Add ( " St. Paul " )
lstCapitals . Add ( " Jackson " )
lstCapitals . Add ( " Jefferson City " )
lstCapitals . Add ( " Helena " )
lstCapitals . Add ( " Lincoln " )
lstCapitals . Add ( " Carson City " )
lstCapitals . Add ( " Concord " )
lstCapitals . Add ( " Trenton " )
lstCapitals . Add ( " Santa Fe " )
lstCapitals . Add ( " Albany " )
lstCapitals . Add ( " Raleigh " )
lstCapitals . Add ( " Bismarck " )
lstCapitals . Add ( " Columbus " )
lstCapitals . Add ( " Oklahoma City " )
lstCapitals . Add ( " Salem " )
lstCapitals . Add ( " Harrisburg " )
lstCapitals . Add ( " Providence " )
lstCapitals . Add ( " Columbia " )
lstCapitals . Add ( " Pierre " )
lstCapitals . Add ( " Nashville " )
lstCapitals . Add ( " Austin " )
lstCapitals . Add ( " Salt Lake City " )
lstCapitals . Add ( " Montpelier " )
lstCapitals . Add ( " Richmond " )
lstCapitals . Add ( " Olympia " )
lstCapitals . Add ( " Charleston " )
lstCapitals . Add ( " Madison " )
lstCapitals . Add ( " Cheyenne " )
'Pulls a name randomly from the list
Dim stringname As String = lstCapitals . Item ( VERAG_VARIABLES . RandomInteger ( 0 , lstCapitals . Count ) )
usrname = stringname
'Pulls a name randomly from the list
Dim stringname As String = lstCapitals . Item ( VERAG_VARIABLES . RandomInteger ( 0 , lstCapitals . Count ) )
usrname = stringname
Using cmd As New SqlCommand ( " INSERT INTO [VERAG_HOMEPAGE].[dbo].[Users] VALUES (@UserId,@Username,@Password,@Email,@Date " )
' cmd.CommandType = CommandType.StoredProcedure
cmd . Parameters . AddWithValue ( " @UserId " , UsrID )
cmd . Parameters . AddWithValue ( " @Username " , usrname )
cmd . Parameters . AddWithValue ( " @Password " , pw )
cmd . Parameters . AddWithValue ( " @Email " , email )
cmd . Parameters . AddWithValue ( " @Date " , DateCreate )
cmd . Parameters . AddWithValue ( " Dateloggedinlast " , datelastloggedin )
cmd . Connection = con
con . Open ( )
' userId = Convert.ToInt32(cmd.ExecuteScalar())
cmd . ExecuteScalar ( )
con . Close ( )
End Using
Next
Using cmd As New SqlCommand ( " INSERT INTO [VERAG_HOMEPAGE].[dbo].[Users] VALUES (@UserId,@Username,@Password,@Email,@Date " )
' cmd.CommandType = CommandType.StoredProcedure
cmd . Parameters . AddWithValue ( " @UserId " , UsrID )
cmd . Parameters . AddWithValue ( " @Username " , usrname )
cmd . Parameters . AddWithValue ( " @Password " , pw )
cmd . Parameters . AddWithValue ( " @Email " , email )
cmd . Parameters . AddWithValue ( " @Date " , DateCreate )
cmd . Parameters . AddWithValue ( " Dateloggedinlast " , datelastloggedin )
cmd . Connection = con
con . Open ( )
' userId = Convert.ToInt32(cmd.ExecuteScalar())
cmd . ExecuteScalar ( )
con . Close ( )
End Using
Next
End Using
End Sub
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 Using
End Sub
Public Shared DeleteUsers( )
End Class