Here is a quick function to convert ROT13 values (check them out here if you dont know what it is) for PowerShell. No encoding, purely decoding:
function ConvertFrom-Rot13
{
[CmdletBinding()]
param(
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true
)]
[String]
$rot13string
)
[String] $string = $null;
$rot13string.ToCharArray() |
ForEach-Object{
Write-Verbose"$($_): $([int] $_)"
if((([int] $_ -ge 97) -and ([int] $_ -le 109)) -or (([int] $_ -ge 65) -and ([int] $_ -le 77)))
{
$string += [char] ([int] $_ + 13);
}
elseif((([int] $_ -ge 110) -and ([int] $_ -le 122)) -or (([int] $_ -ge 78) -and ([int] $_ -le 90)))
{
$string += [char] ([int] $_ - 13);
}
else
{
$string += $_
}
}
$string
}
Related Posts by Categories
0 comments:
Post a Comment