Fix bug + add commented test code.

This commit is contained in:
Derek Jamison 2023-04-19 15:31:49 -04:00
parent 6ad7d9e2b0
commit 80e445b094

View File

@ -65,6 +65,9 @@ Function Get-Decoded-SSID {
$result = $result + $dict[$ch - $index]
$i = $i + 1
$index = $ch
if ($index -ge $cypherLetters.Count) {
$index = $index - $cypherLetters.Count
}
$index = $index + (([int][char]$cypherLetters[$index]) * $i)
$index = $index % $cypherLetters.Count
}
@ -97,6 +100,19 @@ Function Get-SSIDS {
}
}
## Test that Get-Decoded-SSID can get back original string that was passed to Get-Encoded-SSID
# For($i = 0; $i -lt 100000; ++$i) {
# $r = (""+(Get-Random -Maximum 1000000 -Minimum 0)+(Get-Random -Maximum 1000000 -Minimum 0))
# $r = $r.Substring((Get-Random) % $r.Length)
# $p = (""+(Get-Random 9))
# $d = Get-Decoded-SSID (Get-Encoded-SSID -Message $r -Prefix $p)
# if ($r -ne $d) {
# Write-Host ("Fail. r:"+$r+" p:"+$p+" d:"+$d)
# } else {
# # Write-Host ("Pass. r:"+$r+" p:"+$p+" d:"+$d)
# }
# }
while ($true) {
Show-Available-Networks-UI
For( $i = 0; $i -le 6; ++$i ) {