Post Reply 
Social Buttons
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#][SRC]ROT13 Class
Author Message
Ethereal Offline
Moderator
*******

Trade Count: (0)
Posts: 39
Joined: Jan 2011
Reputation: 5
Post: #1
[C#][SRC]ROT13 Class
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.
01-15-2011 05:41 PM
Find all posts by this user Quote this message in a reply
Ironside Offline
Site Owner
**********

Trade Count: (0)
Posts: 170
Joined: Nov 2010
Reputation: 7
Post: #2
RE: [C#][SRC]ROT13 Class
Interesting, this is definitely a good share.
Will probably come useful in the near future.
01-15-2011 05:44 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: