?? des.h
字號:
// Des.h: interface for the CDes class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DES_H__E0A91F40_DF86_11D6_B0C1_00E04C391A51__INCLUDED_)
#define AFX_DES_H__E0A91F40_DF86_11D6_B0C1_00E04C391A51__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//////////////////////////////////////////////////////////////////////
#include "FileInOut.h"
//////////////////////////////////////////////////////////////////////
#define BUFSIZE (1024*50)
//////////////////////////////////////////////////////////////////////
struct deshead
{
UCHAR Ver; //版本
DWORD TLen;//文件長度
char DesKey[16];//DES密鑰密文
};
typedef struct deshead DesHead;
typedef bool (*PSubKey)[16][48];
enum {ENCRYPT,DECRYPT};
//////////////////////////////////////////////////////////////////////
//DES(class CDes)
class CDes: public CFileInOut
{
public:
// 以下代碼作者:0200980 胡德華
bool Encrypt(const char *OutFile,const char *InFile,const char *KeyStr);//加密
bool Decrypt(const char *OutFile,const char *InFile,const char *KeyStr);//解密
// 以下代碼作者:0200935 王俊川
bool Encrypt(HFILE &fh_out,HFILE &fh_in,const char *KeyStr);//加密
bool Decrypt(HFILE &fh_out,HFILE &fh_in,const char *KeyStr);//解密
// 以下代碼作者:0200980 胡德華
bool Encrypt(char *Out,char *In,UINT len,const char *KeyStr=0);//加密
bool Decrypt(char *Out,char *In,UINT len,const char *KeyStr=0);//解密
bool SetSubKey(const char *KeyStr);//由輸入密鑰串設置子密鑰
static char* RandKeyStr(char KeyStr[9]);//產生隨機密鑰串
private:
// 以下代碼作者:0200935 王俊川
void DES(char Out[8],char In[8],const PSubKey pSubKey,bool Type=ENCRYPT);//加/解密
// 以下代碼作者:0200980 胡德華
void SetSubKey(PSubKey pSubKey,const char Key[8]);//由輸入密鑰設置16圈子密鑰
void F_func(bool In[32],const bool Ki[48]);//f 函數
void S_func(bool Out[32],const bool In[48]);//S 盒代替
private:
bool SubKey[2][16][48];//16圈子密鑰
bool Is3DES;//3次DES標志
char deskey[17];//密鑰串緩沖區
char databuf[BUFSIZE];//數據緩沖區
DesHead deshead;//信息頭
};
#endif // !defined(AFX_DES_H__E0A91F40_DF86_11D6_B0C1_00E04C391A51__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -