问题描述
我想用一种文件来存储个人信息不晓得用那中格式的文件方便读写有可以对文件的内容加密
解决方案
解决方案二:
将信息字符串用des加密算法将客户信息加密后存放文件,读取内容时解密//Thissampledemonstratesusingakeybasedonthecryptographicserviceprovider(CSP)version//oftheDataEncryptionStandard(DES)algorithmtoencryptastringtoabytearray,andthen//todecryptthebytearraybacktoastring.usingSystem;usingSystem.IO;usingSystem.Text;usingSystem.Security.Cryptography;classCryptoMemoryStream{//Mainmethod.publicstaticvoidMain(){//CreateanewDESkey.DESCryptoServiceProviderkey=newDESCryptoServiceProvider();//Encryptastringtoabytearray.byte[]buffer=Encrypt("Thisissomeplaintext!",key);//Decryptthebytearraybacktoastring.stringplaintext=Decrypt(buffer,key);//Displaytheplaintextvaluetotheconsole.Console.WriteLine(plaintext);}//Encryptthestring.publicstaticbyte[]Encrypt(stringPlainText,SymmetricAlgorithmkey){//Createamemorystream.MemoryStreamms=newMemoryStream();//CreateaCryptoStreamusingthememorystreamandthe//CSPDESkey.CryptoStreamencStream=newCryptoStream(ms,key.CreateEncryptor(),CryptoStreamMode.Write);//CreateaStreamWritertowriteastring//tothestream.StreamWritersw=newStreamWriter(encStream);//Writetheplaintexttothestream.sw.WriteLine(PlainText);//ClosetheStreamWriterandCryptoStream.sw.Close();encStream.Close();//Getanarrayofbytesthatrepresents//thememorystream.byte[]buffer=ms.ToArray();//Closethememorystream.ms.Close();//Returntheencryptedbytearray.returnbuffer;}//Decryptthebytearray.publicstaticstringDecrypt(byte[]CypherText,SymmetricAlgorithmkey){//Createamemorystreamtothepassedbuffer.MemoryStreamms=newMemoryStream(CypherText);//CreateaCryptoStreamusingthememorystreamandthe//CSPDESkey.CryptoStreamencStream=newCryptoStream(ms,key.CreateDecryptor(),CryptoStreamMode.Read);//CreateaStreamReaderforreadingthestream.StreamReadersr=newStreamReader(encStream);//Readthestreamasastring.stringval=sr.ReadLine();//Closethestreams.sr.Close();encStream.Close();ms.Close();returnval;}}
解决方案三:
源码给了没什么说的了要是开发的机器能上网给你个我自己写的管理个人信息的WIN程序
解决方案四:
有比DES更高级的加密算法米的
解决方案五:
mark
解决方案六:
不明白你说的高级是何解,但是我想如果我的言值够复杂你是不能轻易破解的==
解决方案七:
#2楼的加QQ669336293