test1-11new

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test1_11new
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入一行原字符串");
string s_text = Console.ReadLine();
Console.WriteLine("请输入密钥字符串");
string s_key = Console.ReadLine();
if(s_text.Length!=s_key.Length)
Console.WriteLine("密钥与字符串长度必须相等");
string ch=null;
string s_result = null ;
for (int i = 0; i < s_text.Length; i++)
{
ch+=s_text[i];
s_result+= (char)(ch[i] ^ s_key[i]);
}
Console.WriteLine(s_result);

}
}
}

原文地址:https://www.cnblogs.com/YuJiaJia/p/7506561.html