Skip to content

Instantly share code, notes, and snippets.

@WimObiwan
Last active March 14, 2017 07:55
Show Gist options
  • Save WimObiwan/fd21232cea6c6190033e69ffba06498d to your computer and use it in GitHub Desktop.
Save WimObiwan/fd21232cea6c6190033e69ffba06498d to your computer and use it in GitHub Desktop.
$key = @{}
# First 1-on-1 mapping of all characters
for ($i = 0; $i -le 255; $i++) { $key[[char]$i] = [char]$i }
#Shift all alphabet characters on character backwards
for ($i = [byte][char]'B'; $i -le [byte][char]'Z'; $i++) { $key[[char]$i] = [char]($i - 1) }
$key[[char]'A'] = [char]'Z'
for ($i = [byte][char]'b'; $i -le [byte][char]'z'; $i++) { $key[[char]$i] = [char]($i - 1) }
$key[[char]'a'] = [char]'z'
$text = 'Ojfnboe mbbu ifu bdiufstuf wbo ajko upoh ajfo. Ffo jfnboe xffu nffs nbbs hffgu wppsmpqjh ojfut qsjkt. Pg njttdijfo updi xfm? Lfo kjk ef jefoujufju wbo ef npm?'
-join ($text.ToCharArray() | foreach { $key[$_] })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment