My solution for https://ironscripter.us/a-powershell-cryptogram/
$crypto = @" | |
P k T r 2 s z 2 * c F - | |
r a z 7 G u D 4 w 6 U # | |
g c t K 3 E @ B t 1 a Y | |
Q P i c % 7 0 5 Z v A e | |
W 6 j e P R f p m I ) H | |
y ^ L o o w C n b J d O | |
S i 9 M b e r # ) i e U | |
* f 2 Z 6 M S h 7 V u D | |
5 a ( h s v 8 e l 1 o W | |
Z O 7 l p K y J l D z $ | |
- j I @ t T 2 3 R a i k | |
q = F & w B 6 c % H l y | |
"@ | |
function Check-Decrypt($x, $y, $crypto){ | |
$crypto = $crypto.split() -join '' | |
$current_variable = 'x' | |
$Result = @() | |
while($true){ | |
if ((Get-Variable $current_variable).value -gt $crypto.length){break} | |
$Substring = $crypto.Substring(0, (Get-Variable $current_variable).value) | |
$crypto = $crypto.TrimStart($Substring) | |
$Result += $Substring[-1] | |
if ($current_variable -eq 'x'){$current_variable = 'y'}else{$current_variable = 'x'} | |
} | |
$Result -join '' | |
} | |
$xs = (1..20) | |
$ys = (1..20) | |
$i = 0 | |
Write-Host | |
foreach ($x in $xs){ | |
foreach ($y in $ys){ | |
$r = Check-Decrypt -x $x -y $y -crypto $crypto | |
Write-Host "[x:$x|y:$y] = $r" | |
$i ++ | |
if (($i % 5) -eq 0){Read-Host -Prompt "Press ENTER key to get next 5 results or CTRL+C to quit"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment