Jan 23, 2011 03:04 PM
(This post was last modified: Jan 24, 2011 09:50 AM by Ethereal.)
The original source was from Aeonhack. I updated it with string parameter overloads, and also translated it into C# for my fellow coders.
So here it is:
C#
Usage:
VB .NET
Usage:
So here it is:
C#
Code
class XOREncryption
{
/// <summary>
/// Encrypts your data via XOR. Original source by Aeonhack. Updated and translated by Ethereal of HackForums.net
/// Leave the credits.
/// </summary>
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
public string XORData(string data, string password) {
return encoding.GetString(XORData(encoding.GetBytes(data), encoding.GetBytes(password)));
}
public byte[] XORData(byte[] data, byte[] password)
{
int x = password.Length;
for (int index = 0; index < data.Length; index++)
{
data[index] = Convert.ToByte(data[index] ^ password[index % x]);
}
return data;
}
}Usage:
Code
txtBox.Text = XOREncryption.XORData("Test text", "TestKeyVal");
txtBox.Text = XOREncryption.XORData(YourByteArrData, YourByteArrPass);VB .NET
Code
Class XOREncryption
'Original Byte() function by Aeonhack. Updated by Ethereal of HackForums.net
'Leave the credits.
Dim encoding As New System.Text.UTF8Encoding()
Function XORData(ByVal data As String, ByVal password As String) As String
Return encoding.GetString(XORData(encoding.GetBytes(data), encoding.GetBytes(password)))
End Function
Function XORData(ByVal data As Byte(), ByVal password As Byte()) As Byte()
Dim X As Integer = password.Length
For I As Integer = 0 To data.Length - 1
data(I) = data(I) Xor password(I Mod X)
Next
Return data
End Function
End ClassUsage:
Code
TextBox1.Text = XOREncryption.XORData("Test Data", "Test Pass")
Dim ByteArr As Byte() = XOREncryption.XORData(YourByteArrData, YourByteArrPass)μεγαλομανία



