using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace XOREncryption
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string XorEncrypt(string text, int key)
{
string newText = "";
for (int i = 0; i < text.Length; i++)
{
int charValue = Convert.ToInt32(text); //get the ASCII value of the character
charValue ^= key; //xor the value
newText += char.ConvertFromUtf32(charValue); //convert back to string
}
return newText;
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace XOREncryption
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string XorEncrypt(string text, int key)
{
string newText = "";
for (int i = 0; i < text.Length; i++)
{
int charValue = Convert.ToInt32(text); //get the ASCII value of the character
charValue ^= key; //xor the value
newText += char.ConvertFromUtf32(charValue); //convert back to string
}
return newText;
}
}
}
转载于:https://blog.51cto.com/r00tsh3ll/181356