📄 des.h
字号:
// DES.h: interface for the CDES class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _DES_H_
#define _DES_H_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDES
{
public:
CDES();
virtual ~CDES();
int encrypt(unsigned char key[8], unsigned char* data, int blocks = 1);
int decrypt(unsigned char key[8], unsigned char* data, int blocks = 1);
int yencrypt(unsigned char key[8], unsigned char* data, int size);
int ydecrypt(unsigned char key[8], unsigned char* in, int blocks, int* size = 0);
int extend(int size) { return (size/8+1)*8; };
enum Mode { ENCRYPT, DECRYPT };
private:
void des(unsigned char* in, unsigned char* out, int blocks);
void des_block(unsigned char* in, unsigned char* out);
void deskey(unsigned char key[8], Mode md);
void usekey(unsigned long *);
void cookey(unsigned long *);
void scrunch(unsigned char *, unsigned long *);
void unscrun(unsigned long *, unsigned char *);
void desfunc(unsigned long *, unsigned long *);
private:
unsigned long KnL[32];
static unsigned char Df_Key[24];
static unsigned short bytebit[8];
static unsigned long bigbyte[24];
static unsigned char pc1[56];
static unsigned char totrot[16];
static unsigned char pc2[48];
static unsigned long SP1[64];
static unsigned long SP2[64];
static unsigned long SP3[64];
static unsigned long SP4[64];
static unsigned long SP5[64];
static unsigned long SP6[64];
static unsigned long SP7[64];
static unsigned long SP8[64];
};
#endif //#ifndef _DES_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -