教学服务系统

 找回密码
 立即注册
搜索
查看: 494|回复: 0

信息计算2019班2班31号吴明霞

[复制链接]

8

主题

20

帖子

152

积分

注册会员

Rank: 2

积分
152
发表于 2022-4-15 23:10:48 | 显示全部楼层 |阅读模式
本帖最后由 吴明霞 于 2022-4-15 23:28 编辑

1.运行程序
3DES是三重数据加密算法块密码,通过引用TripleDES-类中的方法进行加密和解密。主程序代码:
  1. using System;
  2. using System.Text;
  3. using System.IO;
  4. using System.Security.Cryptography;

  5. namespace ConsoleApp1
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             //待加密文件的路径
  12.             string one = @"D:\Microsoft Visual Studio\1.1.txt";
  13.             //加密后文件的输出路径
  14.             string two1 = @"D:\Microsoft Visual Studio\1.2.txt";
  15.             //待解密文件的路径
  16.             string two2 = @"D:\Microsoft Visual Studio\1.2.txt";
  17.             //解密后文件的输出路径
  18.             string three = @"D:\Microsoft Visual Studio\1.3.txt";

  19.             //密钥key
  20.             string key = "2022.4.15@";

  21.             //加/解密方法File to File
  22.             TripleDES_ my3des = new TripleDES_(key);
  23.             my3des.Encrypt(one, two1);
  24.             my3des.Decrypt(two2, three);
  25.         }
  26.     }
  27. }
复制代码

借助Encrypt与Decrypt函数实现加密与解密
  1. my3des.Encrypt(one, two1);
  2. my3des.Decrypt(two2, three);
复制代码


2.运行结果:






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

教学服务系统

GMT+8, 2025-4-30 08:09 , Processed in 0.018393 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表