資源簡介
網(wǎng)上流傳很多版本的C#凱撒密碼算法及程序,其中絕大部分不可用,故有此程序.更多內(nèi)容見http://blog.csdn.net/askfuhu/article/details/6825289

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
namespace?caeser
{
????public?partial?class?Form1?:?Form
????{
????????private?int?key?=?0;
????????private?string?str?=?““;
????????private?OpenFileDialog?ofd?=?new?OpenFileDialog();
????????private?SaveFileDialog?sfd?=?new?SaveFileDialog();
????????public?Form1()
????????{
????????????InitializeComponent();
????????????comboBox1.SelectedIndex?=?0;
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????this.key?=?Convert.ToInt32(comboBox1.SelectedItem.ToString());
????????????char[]?ch?=?this.str.ToArray();
????????????//byte[]?a?=?System.Text.Encoding.Default.GetBytes(str);
????????????
????????????string?strCaesar?=?““;
????????????if?(radioButton1.Checked?==?false?&&?radioButton2.Checked?==?false)
????????????{
????????????????MessageBox.Show(“請選擇所需要執(zhí)行的功能“);
????????????}
????????????else?if?(radioButton1.Checked?==?true)
????????????{
????????????????for?(int?i?=?0;?i?????????????????{
????????????????????string?sou?=?ch[i].ToString();
????????????????????string?tar?=?““;
????????????????????bool?isChar?=?“abcdefghijklmnopqrstuvwxyz“.Contains(sou.ToLower());
????????????????????bool?isToUpperChar?=?isChar?&&?(sou.ToUpper()?==?sou);
????????????????????sou?=?sou.ToLower();
????????????????????if?(isChar)
????????????????????{
????????????????????????int?offset?=?(AscII(sou)?+?key?-?AscII(“a“))?%?(AscII(“z“)?-?AscII(“a“)?+?1);
????????????????????????tar?=?Convert.ToChar(offset?+?AscII(“a“)).ToString();
????????????????????????if?(isToUpperChar)
????????????????????????{
????????????????????????????tar?=?tar.ToUpper();
????????????????????????}
????????????????????}
????????????????????else
????????????????????{
????????????????????????tar?=?sou;
????????????????????}
????????????????????strCaesar?+=?tar;
????????????????}
????????????}
????????????else?if?(radioButton2.Checked?==?true)
????????????{
????????????????for?(int?i?=?0;?i?????????????????{
????????????????????string?sou?=?ch[i].ToString();
????????????????????string?tar?=?““;
????????????????????bool?isChar?=?“abcdefghijklmnopqrstuvwxyz“.Contains(sou.ToLower());
????????????????????bool?isToUpperChar?=?isChar?&&?(sou.ToUpper()?==?sou);
????????????????????sou?=?sou.ToLower();
????????????????????if?(isChar)
????????????????????{
????????????????????????int?offset?=?(AscII(“z“)?+?key?-?AscII(sou))?%?(AscII(“z“)?-?AscII(“a“)?+?1);
????????????????????????tar?=?Convert.ToChar(AscII(“z“)?-?offset).ToString();
????????????????????????if?(isToUpperChar)
????????????????????????{
????????????????????????????tar?=?tar.ToUpper();
????????????????????????}
????????????????????}
????????????????????else
????????????????????{
???????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????15360??2011-09-26?14:37??caeser\caeser\bin\Debug\app.publish\Application?Files\caeser_1_0_0_0\caeser.exe.deploy
?????文件???????6652??2011-09-26?14:37??caeser\caeser\bin\Debug\app.publish\Application?Files\caeser_1_0_0_0\caeser.exe.manifest
?????文件?????????45??2011-09-26?14:37??caeser\caeser\bin\Debug\app.publish\autorun.inf
?????文件???????5593??2011-09-26?14:37??caeser\caeser\bin\Debug\app.publish\caeser.application
?????文件?????428984??2011-09-26?14:37??caeser\caeser\bin\Debug\app.publish\setup.exe
?????文件??????15872??2011-09-26?22:37??caeser\caeser\bin\Debug\caeser.exe
?????文件??????28160??2011-09-26?22:37??caeser\caeser\bin\Debug\caeser.pdb
?????文件??????11600??2011-09-26?22:37??caeser\caeser\bin\Debug\caeser.vshost.exe
?????文件????????490??2010-03-17?22:39??caeser\caeser\bin\Debug\caeser.vshost.exe.manifest
?????文件???????3725??2011-09-25?11:05??caeser\caeser\caeser.csproj
?????文件????????496??2011-09-26?14:43??caeser\caeser\caeser.csproj.user
?????文件???????1676??2011-09-26?14:37??caeser\caeser\caeser_TemporaryKey.pfx
?????文件???????6601??2011-09-26?22:37??caeser\caeser\Form1.cs
?????文件??????13070??2011-09-26?21:40??caeser\caeser\Form1.Designer.cs
?????文件???????6193??2011-09-26?21:40??caeser\caeser\Form1.resx
?????文件????????673??2011-09-26?22:37??caeser\caeser\obj\x86\Debug\caeser.csproj.FileListAbsolute.txt
?????文件??????15872??2011-09-26?22:37??caeser\caeser\obj\x86\Debug\caeser.exe
?????文件????????180??2011-09-26?21:40??caeser\caeser\obj\x86\Debug\caeser.Form1.resources
?????文件??????28160??2011-09-26?22:37??caeser\caeser\obj\x86\Debug\caeser.pdb
?????文件????????180??2011-09-26?18:33??caeser\caeser\obj\x86\Debug\caeser.Properties.Resources.resources
?????文件???????4440??2011-09-25?13:53??caeser\caeser\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6340??2011-09-26?22:37??caeser\caeser\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????240??2011-09-26?21:40??caeser\caeser\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件????????574??2011-09-26?21:40??caeser\caeser\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件???????8626??2011-09-25?13:58??caeser\caeser\obj\x86\Debug\ResolveAssemblyReference.cache
?????文件????????487??2011-09-25?11:00??caeser\caeser\Program.cs
?????文件???????1344??2011-09-25?11:00??caeser\caeser\Properties\AssemblyInfo.cs
?????文件???????2860??2011-09-25?11:00??caeser\caeser\Properties\Resources.Designer.cs
?????文件???????5612??2011-09-25?11:00??caeser\caeser\Properties\Resources.resx
?????文件???????1089??2011-09-25?11:00??caeser\caeser\Properties\Settings.Designer.cs
............此處省略20個文件信息
評論
共有 條評論