用c实现des算法!!!

来源:百度知道 编辑:UC知道 时间:2024/05/14 06:19:12
各位好,请求各位c学习者帮助钉解决这个问题。
我想用des算法对我的名字进行加密
我也在网上下载了des算法,包括FileDES,SubKey,Des各程序,
可能没真正理解这些程序,所以我想调用都不知道将这些东西
组合起来,有知道的请帮帮忙啊!

/* d3des.h -
*
* Headers and defines for d3des.c
* Graven Imagery, 1992.
*
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
* (GEnie : OUTER; CIS : [71755,204])
*/

#define D2_DES /* include double-length support */
#define D3_DES /* include triple-length support */

#ifdef D3_DES
#ifndef D2_DES
#define D2_DES /* D2_DES is needed for D3_DES */
#endif
#endif

#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */

/* A useful alias on 68000-ish machines, but NOT USED HERE. */

typedef union {
unsigned long blok[2];
unsigned short word[4];
unsigned char byte[8];
} M68K;

extern void deskey(unsigned char *, short);
/* hexkey[8] MODE
* Sets the internal key register according to the hexadecimal
* key contained in the 8 bytes of hexkey, according to the DES,
* for en