求C++高手帮我编写一个能运行的3DES加解密算法源程序,谢谢!

2024-11-07 13:46:30
推荐回答(2个)
回答(1):

#if !defined(_CRYPT3DES_H)
#define _CRYPT3DES_H
#if !defined(ED_FLAG)
#define ED_FLAG
#define encrypt 0
#define decrypt 1
#endif
#ifndef _WINDOWS_
#include "windows.h"
#endif
//////////////////////////////////////////////////////////////////////////
/*
unsigned char key[8] = {"doks"};
unsigned char buff[8] = {"abcdef"};
C3DES des;
des.DoDES3(0,buff,key);
des.DoDES3(1,buff,key);
*/
/* 3DES Class. */
class C3DES
{
public:
BOOL DoDES3(int nWay,unsigned char* pSrc,int nSrcSize,unsigned char* pDes,unsigned char pKey[8]);
private:
BOOL DoDES3(
unsigned char EDFlag, //EDFlag是加\脱密标志,0表示加密,1表示脱密
unsigned char databuf[8], //DataBuf将被处理的明文或密文的缓冲区,并兼作输出缓冲区
unsigned char keybuf[8] //8byte的密钥缓冲区
);
inline void pro_key(void);
代码太长http://www.360doc.com/content/14/0502/18/17111906_374002596.shtml

回答(2):

你在做梦?这点财富值