Код:

Function Decrypt($str,$key="oebfFRPncgtprw5") {
$Newstr = ""
$lenKey = $key.Length - 1
$KeyPos = 0
$LenStr = $str.Length
$str = -join ([regex]::Matches($str,'.','RightToLeft') | ForEach {$_.value})
For ($x = $LenStr; $x -ge 1; $x--) {
$Newstr += [char]([int][char]$str.substring(($x-1),1) - [int][char]$key.substring($KeyPos,1))
$KeyPos++
If ($KeyPos -gt $lenKey) { $KeyPos = 0}
}
-join ([regex]::Matches($NewStr,'.','RightToLeft') | ForEach {$_.value})
}