Computer Tech

Full Version: [C#][SRC]ROT13 Class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is my own ROT13 class. It is fast - it did 10,000 characters instantly(1/5 of a second) and I am pretty proud of it.

Some constructive criticism is Ok, but don't flame.

Code:
class ROT13
{
    /// <summary>
    /// This is an implementation of the ROT13(Rotation of 13, a.k.a Caesar Shift) algorithm, coded by Ethereal of HackForums.net.
    /// This will scramble your string into an unreadable form.
    /// </summary>
    public string AlterText(string input)
    {
  char[] text = input.ToCharArray();
  for (int i = 0; i < input.Length; i++)
  {
    int value = (int)text[i];
    if (value >= 'a' && value <= 'm' || value >= 'A' && value <= 'M')
    {
    value += 13;
    }
    else if (value >= 'm' && value <= 'z' || value >= 'M' && value <= 'Z')
    {
    value -= 13;
    }

    text[i] = Convert.ToChar(value);
  }
  string FinVal = new string(text);
  return FinVal;
    }
}

I hope that it is useful to you.

Update* Vigenere and ROT_X class to come soon. One more bug fix for Vigenere.
Interesting, this is definitely a good share.
Will probably come useful in the near future.
Reference URL's