Last active
July 5, 2019 17:40
-
-
Save camusicjunkie/b171ca0254f0919107d8dfd0b660bb3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 | |
"@ | |
$max = 12 | |
for ($y = 1; $y -le $max; $y++) { | |
for ($x = 1; $x -le $max; $x++) { | |
$string = -split $crypto | |
$decrypted = $null | |
$pos = $x - 1 | |
while ($pos -le ($string.Length - 1)) { | |
foreach ($var in @($y, $x)) { | |
if ($pos -ge ($string.Length)) {break} | |
$decrypted += $string.GetValue($pos) | |
$pos += $var | |
} | |
} | |
[pscustomobject] @{ | |
'Interval' = $x, $y | |
'String' = $decrypted | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I must have been testing the original code in a stale environment because as soon as I tried it in a fresh Powershell session I was getting tons of errors. I was improperly looping through the interval values. I’ve updated the loop code and it works as expected now.