|
本帖最后由 吴明霞 于 2022-4-15 23:28 编辑
1.运行程序:
3DES是三重数据加密算法块密码,通过引用TripleDES-类中的方法进行加密和解密。主程序代码:
- using System;
- using System.Text;
- using System.IO;
- using System.Security.Cryptography;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- //待加密文件的路径
- string one = @"D:\Microsoft Visual Studio\1.1.txt";
- //加密后文件的输出路径
- string two1 = @"D:\Microsoft Visual Studio\1.2.txt";
- //待解密文件的路径
- string two2 = @"D:\Microsoft Visual Studio\1.2.txt";
- //解密后文件的输出路径
- string three = @"D:\Microsoft Visual Studio\1.3.txt";
- //密钥key
- string key = "2022.4.15@";
- //加/解密方法File to File
- TripleDES_ my3des = new TripleDES_(key);
- my3des.Encrypt(one, two1);
- my3des.Decrypt(two2, three);
- }
- }
- }
复制代码
借助Encrypt与Decrypt函数实现加密与解密
- my3des.Encrypt(one, two1);
- my3des.Decrypt(two2, three);
复制代码
2.运行结果:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|