3DES加密算法

来源:百度知道 编辑:UC知道 时间:2024/05/12 03:27:54
3DES加密算法中 密钥的长度应该是多少?
我的系统采用3DES加密, ECB模式/使用PKCS7方式填充不足位,目前给的密钥是192位。
可我程序实现出来的结果和示例不同,请问有什么关键点需要注意的,还有。有什么测试验证之类的程序没有啊,谢谢。
其实我只是想知道这个算法的资料,越细越好,在网上找了些,但都不太理想,要是有讲解3DES算法的书就好了,各个模式的3DES及 DES及其它一些常用算法的即通俗易懂又详细的介绍。

using System;
using System.Text;
using System.IO;
using System.Security.Cryptography;

class Class1
{
static void Main()
{
Console.WriteLine("Encrypt String...");
txtKey = "tkGGRmBErvc=";
btnKeyGen();
Console.WriteLine("Encrypt Key :{0}",txtKey);
txtIV = "Kl7ZgtM1dvQ=";
btnIVGen();
Console.WriteLine("Encrypt IV :{0}",txtIV);
Console.WriteLine();

string txtEncrypted = EncryptString("1111");
Console.WriteLine("Encrypt String : {0}",txtEncrypted);

string txtOriginal = DecryptString(txtEncrypted);
Console.WriteLine("Decrypt String : {0}",txtOriginal);
}

private static SymmetricAlgorithm mCSP;
private static string txtKey;
private static string txtIV;

private static void btnKeyGen()
{
mCSP = SetEnc();

byte[