- Joined
- Apr 12, 2013
- Messages
- 897
- Reaction score
- 480
hey, i created in some freetime a little script in C# for Xoring
it's working but only if the key is longer than the text, do you have some suggestions etc?
AND btw: This is not a QQ i wanna Help Thread, it's for discussing etc
Code:
public static void Xor(string text, string key) {
string xored = "";
int[] rofl = new int[text.Length + key.Length];
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] btext = enc.GetBytes(text);
int i = 0;
while (i < btext.Length)
{
if (i == key.Length)
{
i = 0;
}
rofl[i] = btext[i] ^ key[i];
//MsgBox.ShowSt(i.ToString());
xored += rofl[i].ToString("X");
i++;
}
MsgBox.ShowSt(xored);
}
it's working but only if the key is longer than the text, do you have some suggestions etc?
AND btw: This is not a QQ i wanna Help Thread, it's for discussing etc