From: rossum on
On Wed, 2 Sep 2009 09:47:21 -0700 (PDT), shapper <mdmoura(a)gmail.com>
wrote:

>Hello,
>
>Does anyone knows a script to perform Rot13 and Rot5 rotation?
This is a Java method for Rot13; conversion to C# should be simple:

public static String ROT13(String text) {
StringBuilder sb = new StringBuilder(text);
for (int i = 0; i < sb.length(); ++i) {
char c = sb.charAt(i);
if (Character.isLetter(c)) {
if (c >= 'a' && c <= 'm') { c += 13; }
else if (c >= 'n' && c <= 'z') { c -= 13; }
else if (c >= 'A' && c <= 'M') { c += 13; }
else if (c >= 'N' && c <= 'Z') { c -= 13; }
sb.setCharAt(i, c);
}
}
return sb.toString();
} // end ROT13()
>
>And can I use the same script by just changing the value of 13 to 5?
No. 26 mod 13 == 0 but 26 mod 5 != 0. That complicates things.

rossum

>
>Thanks,
>Miguel