资源简介
实现数字签名算法以及验证数字签名算法的正确性。本程序经本人验证
代码片段和文件信息
/* LibTomCrypt modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis tomstdenis@iahu.ca http://libtomcrypt.org
*/
/* MD5 hash function by Tom St Denis */
#include “md5.h“
#ifdef MD5
#define F(xyz) (z ^ (x & (y ^ z)))
#define G(xyz) (y ^ (z & (y ^ x)))
#define H(xyz) (x^y^z)
#define I(xyz) (y^(x|(~z)))
#define FF(abcdMst) \
a = (a + F(bcd) + M + t); a = ROL(a s) + b;
#define GG(abcdMst) \
a = (a + G(bcd) + M + t); a = ROL(a s) + b;
#define HH(abcdMst) \
a = (a + H(bcd) + M + t); a = ROL(a s) + b;
#define II(abcdMst) \
a = (a + I(bcd) + M + t); a = ROL(a s) + b;
#ifdef SMALL_CODE
static const unsigned char Worder[64] = {
0123456789101112131415
1611051015491438132712
5811141471013036912152
0714512310181561341129
};
static const unsigned char Rorder[64] = {
7121722712172271217227121722
591420591420591420591420
4111623411162341116234111623
6101521610152161015216101521
};
static const ulong32 Korder[64] = {
0xd76aa478UL 0xe8c7b756UL 0x242070dbUL 0xc1bdceeeUL 0xf57c0fafUL 0x4787c62aUL 0xa8304613UL 0xfd469501UL
0x698098d8UL 0x8b44f7afUL 0xffff5bb1UL 0x895cd7beUL 0x6b901122UL 0xfd987193UL 0xa679438eUL 0x49b40821UL
0xf61e2562UL 0xc040b340UL 0x265e5a51UL 0xe9b6c7aaUL 0xd62f105dUL 0x02441453UL 0xd8a1e681UL 0xe7d3fbc8UL
0x21e1cde6UL 0xc33707d6UL 0xf4d50d87UL 0x455a14edUL 0xa9e3e905UL 0xfcefa3f8UL 0x676f02d9UL 0x8d2a4c8aUL
0xfffa3942UL 0x8771f681UL 0x6d9d6122UL 0xfde5380cUL 0xa4beea44UL 0x4bdecfa9UL 0xf6bb4b60UL 0xbebfbc70UL
0x289b7ec6UL 0xeaa127faUL 0xd4ef3085UL 0x04881d05UL 0xd9d4d039UL 0xe6db99e5UL 0x1fa27cf8UL 0xc4ac5665UL
0xf4292244UL 0x432aff97UL 0xab9423a7UL 0xfc93a039UL 0x655b59c3UL 0x8f0ccc92UL 0xffeff47dUL 0x85845dd1UL
0x6fa87e4fUL 0xfe2ce6e0UL 0xa3014314UL 0x4e0811a1UL 0xf7537e82UL 0xbd3af235UL 0x2ad7d2bbUL 0xeb86d391UL
};
#endif
#include
#if (ARGTYPE == 0)
void crypt_argchk(char *v char *s int d)
{
fprintf(stderr “_ARGCHK ‘%s‘ failure on line %d of file %s\n“
v d s);
(void)raise(SIGABRT);
}
#endif
void zeromem(void *dst size_t len)
{
unsigned char *mem = (unsigned char *)dst;
_ARGCHK(dst != NULL);
while (len-- > 0)
*mem++ = 0;
}
void burn_stack(unsigned long len)
{
unsigned char buf[32];
zeromem(buf sizeof(buf));
if (len > (unsigned long)sizeof(buf))
burn_stack(len - sizeof(buf));
}
/*this function compress 512bits onceand it is called by md5_process and md5_done*/
#ifdef CLEAN_STACK
static void _md5_compress(md5_state *md unsigned char *buf)
#else
static void md5_compress(md5_stat
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 12391 2005-01-20 13:57 liuzhigao\G__md5.c
文件 58368 2010-06-13 09:37 liuzhigao\G__md5.ncb
文件 4297 2010-06-13 08:29 liuzhigao\G__md5.plg
文件 537 2010-05-30 10:09 liuzhigao\G__md5.dsw
文件 12785 2010-05-30 10:18 liuzhigao\md5.h
文件 3460 2010-05-30 11:37 liuzhigao\G__md5.dsp
文件 14203 2010-06-13 08:30 liuzhigao\md5.cpp
文件 53760 2010-06-13 09:37 liuzhigao\G__md5.opt
文件 12391 2005-01-20 13:57 liuzhigao\liuzhigao\G__md5.c
文件 14030 2010-05-30 10:09 liuzhigao\Debug\G__md5.obj
文件 74752 2010-06-13 08:29 liuzhigao\Debug\vc60.idb
文件 94208 2010-06-13 08:29 liuzhigao\Debug\vc60.pdb
文件 533504 2010-06-13 08:27 liuzhigao\Debug\G__md5.pdb
文件 221283 2010-06-13 08:27 liuzhigao\Debug\G__md5.exe
文件 330700 2010-06-13 08:27 liuzhigao\Debug\G__md5.ilk
文件 99328 2010-06-13 08:27 liuzhigao\Debug\G__md5.bsc
文件 297788 2010-06-13 08:29 liuzhigao\Debug\G__md5.pch
目录 0 2010-06-16 18:50 liuzhigao\liuzhigao
目录 0 2010-06-16 18:50 liuzhigao\Debug
目录 0 2010-06-16 18:50 liuzhigao
----------- --------- ---------- ----- ----
1837785 20
- 上一篇:OrCAD Capture 10.5 精简版 免安装
- 下一篇:追剧达人修改正常版本
评论
共有 条评论