Last active
January 2, 2016 17:09
-
-
Save chillitom/8335042 to your computer and use it in GitHub Desktop.
Powershell Rot47 implementation.. for when Rot13 just isn't secure enough.
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
function Rot47 { param ([string] $in) | |
$table = @{} | |
for ($i = 0; $i -lt 94; $i++) { | |
$table.Add( | |
"!`"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_``abcdefghijklmnopqrstuvwxyz{|}~"[$i], | |
"PQRSTUVWXYZ[\]^_``abcdefghijklmnopqrstuvwxyz{|}~!`"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO"[$i]) | |
} | |
$out = New-Object System.Text.StringBuilder | |
$in.ToCharArray() | %{ | |
$char = if ($table.ContainsKey($_)) {$table[$_]} else {$_} | |
$out.Append($char) | Out-Null | |
} | |
$out.ToString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment