Remove Ads

Share on Facebook Share on Twitter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#][SRC]ROT13 Class
#1
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;
}
}

[/code]

I hope that it is useful to you.

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


Forum Jump:


Users browsing this thread: 1 Guest(s)