一.DES 2.1 说明

  下面我们先看看DES 2.1 的截图:


 附件: 您所在的用户组无法下载或查看附件

二. DES 2.1的简介:

  1.支持任意长度字符串加密解密
  2.明文、密钥可以不足8字节
  3.支持回车换行,Tab等特殊字符
  4.密文可以选择三种方式显示
  5.支持3重DES
  6.支持文件加密、解密
  7.加密时显示进度

三.DES 算法介绍

  关于DES算法的介绍大家可以看我博客里的另一篇文章,DES算法的介绍以及实现(含上次DES程序1.0的源码) ,所以在此不在重述。

四. yxyDES2 Class提供的Public函数

  下面我们来看看yxyDES2 类(Class)里public函数和它们的用法:
  1. //功能:产生16个28位的key
  2.         //参数:源8位的字符串(key),存放key的序号0-1
  3.         //结果:函数将调用private CreateSubKey将结果存于char SubKeys[keyN][16][48]
  4.         void InitializeKey(char* srcBytes,unsigned int keyN);

  5.         //功能:加密8位字符串
  6.         //参数:8位字符串,使用Key的序号0-1
  7.         //结果:函数将加密后结果存放于private szCiphertext[16]
  8.         //      用户通过属性Ciphertext得到
  9.         void EncryptData(char* _srcBytes,unsigned int keyN);

  10.         //功能:解密16位十六进制字符串
  11.         //参数:16位十六进制字符串,使用Key的序号0-1
  12.         //结果:函数将解密候结果存放于private szPlaintext[8]
  13.         //      用户通过属性Plaintext得到
  14.         void DecryptData(char* _srcBytes,unsigned int keyN);

  15.         //功能:加密任意长度字符串
  16.         //参数:任意长度字符串,长度,使用Key的序号0-1
  17.         //结果:函数将加密后结果存放于private szFCiphertextAnyLength[8192]
  18.         //      用户通过属性CiphertextAnyLength得到
  19.         void EncryptAnyLength(char* _srcBytes,unsigned int _bytesLength,unsigned int keyN);

  20.         //功能:解密任意长度十六进制字符串
  21.         //参数:任意长度字符串,长度,使用Key的序号0-1
  22.         //结果:函数将加密后结果存放于private szFPlaintextAnyLength[8192]
  23.         //      用户通过属性PlaintextAnyLength得到
  24.         void DecryptAnyLength(char* _srcBytes,unsigned int _bytesLength, unsigned int keyN);

  25.         //功能:Bytes到Bits的转换,
  26.         //参数:待变换字符串,处理后结果存放缓冲区指针,Bits缓冲区大小
  27.         void Bytes2Bits(char *srcBytes, char* dstBits, unsigned int sizeBits);

  28.         //功能:Bits到Bytes的转换,
  29.         //参数:待变换字符串,处理后结果存放缓冲区指针,Bits缓冲区大小
  30.         void Bits2Bytes(char *dstBytes, char* srcBits, unsigned int sizeBits);

  31.         //功能:Int到Bits的转换,
  32.         //参数:待变换字符串,处理后结果存放缓冲区指针
  33.         void Int2Bits(unsigned int srcByte, char* dstBits);
  34.        
  35.         //功能:Bits到Hex的转换
  36.         //参数:待变换字符串,处理后结果存放缓冲区指针,Bits缓冲区大小
  37.         void Bits2Hex(char *dstHex, char* srcBits, unsigned int sizeBits);
  38.        
  39.         //功能:Bits到Hex的转换
  40.         //参数:待变换字符串,处理后结果存放缓冲区指针,Bits缓冲区大小
  41.         void Hex2Bits(char *srcHex, char* dstBits, unsigned int sizeBits);

  42.         //szCiphertextInBinary的get函数
  43.         char* GetCiphertextInBinary();

  44.         //szCiphertextInHex的get函数
  45.         char* GetCiphertextInHex();

  46.         //Ciphertext的get函数
  47.         char* GetCiphertextInBytes();

  48.         //Plaintext的get函数
  49.         char* GetPlaintext();

  50.         //CiphertextAnyLength的get函数
  51.         char* GetCiphertextAnyLength();

  52.         //PlaintextAnyLength的get函数
  53.         char* GetPlaintextAnyLength();
复制代码
赞助商广告:

TOP