11 在.NET 中如何加密和解密一个字符串
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();
此处省去去多行。。。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。