-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssh-a-speed-partial.ps1
24 lines (23 loc) · 1.1 KB
/
ssh-a-speed-partial.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$aList = 16,32,64,100,200
$totalIter = 5
$listOfTTCK = @()
$listOfTTCP = @()
Write-Host "Average time to create key / Average time to change password"
ForEach ($a in $aList) {
Write-Host -NoNewline "-a $a takes on average: ";
ForEach ($i in (1..$totalIter)) {
# Measure time to create key
$timeToCreateKey = (Measure-Command{ssh-keygen -qa $a -t ed25519 -N password -f test}).TotalMilliseconds
# Measure time to change password
$timeToChangePassword = (Measure-Command{ssh-keygen -qa $a -pP password -N new -f test}).TotalMilliseconds
Remove-Item test*
$listOfTTCK += [System.Math]::Round($timeToCreateKey,2)
$listOfTTCP += [System.Math]::Round($timeToChangePassword,2)
}
$averTTCK = [System.Math]::Round((($listOfTTCK | Measure-Object -Average).Average)/1000,2)
$averTTCP = [System.Math]::Round((($listOfTTCP | Measure-Object -Average).Average)/1000,2)
$listAllTimeToChangePassword = [string]::Join(' ', "$listOfTTCP")
Write-Host "$averTTCK / $averTTCP s ($listAllTimeToChangePassword ms)"
$listOfTTCK = @()
$listOfTTCP = @()
}