阅读:1158回复:0
des加密程序(头文件)
〖Encrypt〗
上一篇|下一篇|回文章 分类讨论区 全部讨论区 本讨论区 发信人: say (实话实说), 信区: Encrypt 标 题: des加密程序(头文件) 发信站: 武汉白云黄鹤站 (Thu Jan 27 17:06:39 2000), 转信 #ifndef __DES_H #define __DES_H #include <stdio.h> #include <assert.h> /****************************************************** * * This is a part of article from tsinghua bbs * I Change it to C language *******************************************************/ // Encrypt/decrypt the data in \"data\", according to the \"key\". // Caller is responsible for confirming the buffer size of \"data\" // points to is 8*\"blocks\" bytes. // The data encrypted/decrypted is stored in data. // The return code is 1:success, other:failed. int encrypt ( char key[8], char* data, int blocks ); int decrypt ( char key[8], char* data, int blocks ); // Encrypt/decrypt any size data,according to a special method. // Before calling yencrypt, copy data to a new buffer with size // calculated by extend. int yencrypt ( char key[8], char* data, int size ); int ydecrypt2 ( char key[8], char* in, int blocks, int* size ); int extend ( int size ); void des(unsigned char* in, unsigned char* out, int blocks); void des_block(unsigned char* in, unsigned char* out); //unsigned long KnL[32]; enum Mode { ENCRYPT, DECRYPT }; void deskey(unsigned char key[8], enum 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 *); /* 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 -- ※ 来源:.武汉白云黄鹤站 bbs.whnet.edu.cn.[FROM: 202.116.9.52] 上一篇|下一篇|回文章 分类讨论区 全部讨论区 本讨论区 Copyright(c)2000 白云黄鹤BBS站 All Rights Reserved. |
|
|