您的位置:首页 > 其它

11 在.NET 中如何加密和解密一个字符串

2014-06-23 00:41 246 查看
string plainText = "This is plain text that we will encrypt";
string password = "P@$$w0rd";

Console.WriteLine(plainText);
Console.WriteLine();

create a new instance of our encryption class passing in the password as the key
DESEncrypt testEncrypt = new DESEncrypt();

string encText = testEncrypt.EncryptString(plainText, password);
Console.WriteLine("****** Encrypted text ******");
Console.WriteLine(encText);
Console.WriteLine();

Console.WriteLine("****** Decrypted text ******");
string plain = testEncrypt.DecryptString(encText, password);
Console.WriteLine(plain);
Console.WriteLine();


此处省去去多行。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐