📄 des.h
字号:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* FILE NAME: DES (.H) *
* *
* MODULE NAME: DES *
* *
* PROGRAMMER: Oren (Previous version: Ephraim Ben Ishai) *
* *
* DESCRIPTION: performs Data Encryption Standard MCC 68K *
* *
* If compiled with the FASTER flag, the encrypting function *
* DES_DES() run approximately 12 times faster (on the 6811 *
* processor), and the program uses 0.6K less ram memory *
* (for static arrays), but it uses about 1.5K more program *
* space. *
* *
* REVISION: 01_01 27/06/95. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _DES_H_
#define _DES_H_
typedef unsigned char BYTE;
typedef signed short SINT;
typedef unsigned short USINT;
typedef int LINT;
typedef unsigned int ULINT;
typedef USINT WORD;
typedef BYTE byte;
typedef BYTE uchar;
typedef SINT sint;
typedef USINT usint;
typedef LINT lint;
typedef ULINT ulint;
typedef signed char sbyte;
typedef BYTE boolean;
typedef BYTE BOOLEAN;
#ifdef FALSE
#undef FALSE
#endif
#ifdef TRUE
#undef TRUE
#endif
#define FALSE (SINT)0
#define TRUE (SINT)1
boolean BankUtil_Bcd2Asc(byte *BcdBuf, byte *AscBuf, usint Len );
boolean BankUtil_Asc2Bcd(byte *AscBuf, byte *BcdBuf, usint Len);
/* --------------------------------------------------------------------------
*
* FUNCTION NAME: DES_SetKey
*
* DESCRIPTION: Generate key schedule for given key and type of cryption.
*
* PARAMETERS: sw1 (in) == FALSE for ignoring parity
* == TRUE for checking parity
*
* sw2 (in) == FALSE for encryption
* == TRUE for decryption
*
* pkey (in) 64-bit key packed in 8 bytes
*
* RETURN: TRUE - if successful
* FALSE - if failed due to bad parity
*
* NOTES: none.
*
* ------------------------------------------------------------------------ */
BYTE DES_SetKey (BYTE sw1, BYTE sw2, BYTE *pkey);
/* --------------------------------------------------------------------------
*
* FUNCTION NAME: DES_DEA
*
* DESCRIPTION: Set key and Performes the encryption
* of a given block
*
* PARAMETERS: in (in) : packed 64-bit input block
*
* out (out) : packed 64-bit output block
*
* key (in) : packed 64-bit key blook
*
* RETURN: none.
*
* NOTES: none.
*
* ------------------------------------------------------------------------ */
void DES_DEA (BYTE *in, BYTE *out, BYTE *key);
/* --------------------------------------------------------------------------
*
* FUNCTION NAME: DES_UDEA
*
* DESCRIPTION: Set key and Performes the decryption
* of a given block
*
* PARAMETERS: in (in) : packed 64-bit input block
*
* out (out) : packed 64-bit output block
*
* key (in) : packed 64-bit key blook
*
* RETURN: none.
*
* NOTES: Added in Jun-24-1999 for PBOC
*
* ------------------------------------------------------------------------ */
void DES_UDEA (BYTE *in, BYTE *out, BYTE *key);
/* --------------------------------------------------------------------------
*
* FUNCTION NAME: DES_DES
*
* DESCRIPTION: Performes the encryption or decription of a given block
*
* PARAMETERS: in (in) : packed 64-bit input block
*
* out (out) : packed 64-bit output block
*
* RETURN: none.
*
* NOTES: none.
*
* ------------------------------------------------------------------------ */
void DES_DES (BYTE *in, BYTE *out /* packed 64-bit INPUT/OUTPUT blocks */);
/*-----------------------------------------------------------------------
* FUNCTION NAME: DES_3DEA
* DESCRIPTION: perform 3 DEA
* PARAMETERS: s_in - source data (8 bytes)
* r_out - output result (8 bytes)
* key - key (16 bytes)
* RETURN: void
* NOTE: Added in Jun-24-1999 for PBOC
*----------------------------------------------------------------------*/
void DES_3DEA(byte *s_in, byte *r_out, byte *key);
/*-----------------------------------------------------------------------
* FUNCTION NAME: DES_3UDEA
* DESCRIPTION: unperform 3 DEA
* PARAMETERS: s_in - source data (8 bytes)
* r_out - output result (8 bytes)
* key - key (16 bytes)
* RETURN: void
* NOTE: Added in Jun-24-1999 for PBOC
*----------------------------------------------------------------------*/
void DES_3UDEA(byte *s_in, byte *r_out, byte *key);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* FILE NAME: DES (.PRV) *
* *
* MODULE NAME: DES *
* *
* PROGRAMMER: Oren (Previous version: Ephraim Ben Ishai) *
* *
* DESCRIPTION: performs Data Encryption Standard MCC 68K *
* *
* If compiled with the FASTER flag, the encrypting function *
* DES_DES() run approximately 12 times faster (on the 6811 *
* processor), and the program uses 0.6K less ram memory *
* (for static arrays), but it uses about 1.5K more program *
* space. *
* *
* REVISION: 01_01 27/06/95. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* ======================================= *
* P R I V A T E P R O T O T Y P E S *
/* ======================================= *
/* --------------------------------------------------------------------------
*
* FUNCTION NAME: Pack8
*
* DESCRIPTION: Pack 64 bytes at 1 bit/byte into 8 bytes at 8 bits/byte
*
* PARAMETERS: ascii (out) : packed block (8 bytes - 8 bits per byte)
*
* binary (in) : unpacked block (64 bytes - 1 bit per byte)
*
* RETURN: none.
*
* NOTES: none.
*
* ------------------------------------------------------------------------ */
void Pack8 (BYTE *ascii, BYTE *binary);
/* --------------------------------------------------------------------------
*
* FUNCTION NAME: Unpack8
*
* DESCRIPTION: Unpack 8 bytes at 8 bits/byte into 64 bytes at 1 bit/byte
*
* PARAMETERS: ascii (in) : packed block (8 bytes - 8 bits per byte)
*
* binary (out) : unpacked block (64 bytes - 1 bit per byte)
*
* RETURN: none.
*
* NOTES: none.
*
* ------------------------------------------------------------------------ */
void Unpack8 (BYTE *ascii, BYTE *binary);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -