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();



此处省去去多行。。


posted @ 2017-06-29 21:03  jzdwajue  阅读(103)  评论(0编辑  收藏  举报