欢迎来到天天文库
浏览记录
ID:34372289
大小:57.30 KB
页数:3页
时间:2019-03-05
《办公文档-des加解密算法的实例》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、莁薅肇莇蒃螀肃莆蚅薃罿莆莅衿袅羂蒇蚁螁羁薀袇聿羀艿蚀羅肀莂袅袁聿蒄蚈螇肈蚆蒁膆肇莆螆肂肆蒈蕿羈肅薀螅袄肄芀薇螀肄莂螃肈膃蒅薆羄膂薇螁袀膁芇薄袆膀葿衿螂腿薁蚂肁膈芁袈羇膈莃蚁袃膇蒆袆蝿芆薈虿肇芅芈蒂羃芄莀蚇罿芃薂蒀袅节节螅螁节莄薈肀芁蒆螄羆芀蕿薇袂荿芈螂螈莈莁薅肇莇蒃螀肃莆蚅薃罿莆莅衿袅羂蒇蚁螁羁薀袇聿羀艿蚀羅肀莂袅袁聿蒄蚈螇肈蚆蒁膆肇莆螆肂肆蒈蕿羈肅薀螅袄肄芀薇螀肄莂螃肈膃蒅薆羄膂薇螁袀膁芇薄袆膀葿衿螂腿薁蚂肁膈芁袈羇膈莃蚁袃膇蒆袆蝿芆薈虿肇芅芈蒂羃芄莀蚇罿芃薂蒀袅节节螅螁节莄薈肀芁蒆螄羆芀蕿薇袂荿芈螂螈莈莁薅肇莇蒃螀肃莆蚅薃罿莆莅衿袅羂蒇蚁螁羁薀袇聿羀艿蚀
2、羅肀莂袅袁聿蒄蚈螇肈蚆蒁膆肇莆螆肂肆蒈蕿羈肅薀螅袄肄芀薇螀肄莂螃肈膃蒅薆羄膂薇螁袀膁芇薄袆膀葿衿螂腿薁蚂肁膈芁袈羇膈莃蚁袃膇蒆袆蝿芆薈虿肇芅芈蒂羃芄莀蚇罿芃薂蒀袅节节螅螁节莄薈肀芁蒆螄羆芀蕿薇袂荿芈螂螈莈莁薅肇莇蒃螀肃莆蚅薃罿莆莅衿袅羂蒇蚁螁羁薀袇聿羀艿蚀羅肀莂袅袁聿蒄蚈螇肈蚆蒁膆肇莆螆肂肆蒈蕿羈肅薀螅袄肄芀薇螀肄莂螃肈膃蒅薆羄膂薇螁袀膁芇薄袆膀葿衿螂腿薁蚂肁膈芁袈羇膈莃蚁袃膇蒆袆蝿芆薈虿肇芅芈蒂羃芄莀蚇罿芃薂蒀袅节节螅螁节莄薈肀usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usin
3、gSystem.Security.Cryptography;usingSystem.IO;namespaceConsoleApplication2{classProgram{staticvoidMain(string[]args){//DESCryptoServiceProviderdesCry=newDESCryptoServiceProvider();//desCry.GenerateKey();//desCry.GenerateIV();//byte[]key=desCry.Key;//byte[]iv=desCry.IV;//UnicodeEncod
4、ingcncoder=newUnicodeEncoding();//strings=cncoder.GetString(key);//stringivs=cncoder.GetString(iv);//Console.WriteLine(ivs);//Console.WriteLine(s);//Console.WriteLine(key.LongLength);//Console.WriteLine(ivs.Length);//ÓÃDESËã·¨¼ÓÃÜstrings="12345";stringkey="abcdefgh";stringiv="abcde
5、fgh";ASCIIEncodingASC=newASCIIEncoding();byte[]keys=ASC.GetBytes(key);byte[]ivs=ASC.GetBytes(iv);DESCryptoServiceProviderdes=newDESCryptoServiceProvider();des.Key=keys;des.IV=ivs;FileStreamfilestream=newFileStream("des.txt",FileMode.Create);CryptoStreamcrytostream=newCryptoStream(f
6、ilestream,des.CreateEncryptor(keys,ivs),CryptoStreamMode.Write);StreamWriterwriter=newStreamWriter(crytostream);writer.WriteLine(s);writer.Close();}}}//DES½âÃÜËã·¨usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Security.Cryptography;usingSystem.IO;namespace
7、ConsoleApplication2{classProgram{staticvoidMain(string[]args){//DESCryptoServiceProviderdesCry=newDESCryptoServiceProvider();//desCry.GenerateKey();//desCry.GenerateIV();//byte[]key=desCry.Key;//byte[]iv=desCry.IV;//UnicodeEncodingcncoder=newUnicodeEncoding();//strings=cncoder.GetS
8、tring(key);//stringivs=cnc
此文档下载收益归作者所有