求C++高手帮我编写一个能运行的3DES加解密算法源程序,谢谢! 15
2个回答
展开全部
#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
#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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询