資源簡介
HMAC-SHA1算法實現,可以直接執行,測試通過
代碼片段和文件信息
#include?“sha1.h“
#include?
#include?
#include?
#include?
#ifndef?SHA_DIGESTSIZE
#define?SHA_DIGESTSIZE?20
#endif
#ifndef?SHA_BLOCKSIZE
#define?SHA_BLOCKSIZE?64
#endif
/*?Hash?a?single?512-bit?block.?This?is?the?core?of?the?algorithm.?*/
void?SHA1Transform(__u32?state[5]?__u8?buffer[64])
{
__u32?a?b?c?d?e;
typedef?union?{
????unsigned?char?c[64];
????__u32?l[16];
}?CHAR64LONG16;
CHAR64LONG16*?block;
#ifdef?SHA1HANDSOFF
static?unsigned?char?workspace[64];
????block?=?(CHAR64LONG16*)workspace;
//????NdisMoveMemory(block?buffer?64);
????memcpy(block?buffer?64);
#else
????block?=?(CHAR64LONG16*)buffer;
#endif
????/*?Copy?context->state[]?to?working?vars?*/
????a?=?state[0];
????b?=?state[1];
????c?=?state[2];
????d?=?state[3];
????e?=?state[4];
????/*?4?rounds?of?20?operations?each.?Loop?unrolled.?*/
????R0(abcde?0);?R0(eabcd?1);?R0(deabc?2);?R0(cdeab?3);
????R0(bcde
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3474??2008-10-08?18:34??HMACMD5.dsp
?????文件??????33792??2008-10-08?18:34??HMACMD5.ncb
?????文件??????48640??2008-10-08?18:34??HMACMD5.opt
?????文件???????1319??2008-10-08?18:33??HMACMD5.plg
?????文件???????7123??2008-10-08?18:59??HMACSHA1.c
?????文件???????3482??2008-10-08?18:36??HMACSHA1.dsp
?????文件????????541??2008-10-08?18:36??HMACSHA1.dsw
?????文件??????50176??2008-10-08?19:00??HMACSHA1.ncb
?????文件??????53760??2008-10-08?19:00??HMACSHA1.opt
?????文件???????1172??2008-10-08?18:59??HMACSHA1.plg
?????文件???????3124??2008-10-08?18:56??HMACSHA1測試文本文檔.txt
?????文件???????1724??2008-10-08?18:22??sha1.h
-----------?---------??----------?-----??----
???????????????208327????????????????????12
- 上一篇:A*算法在ROS上的簡單移植
- 下一篇:c語言異或實現音頻的加密解密
評論
共有 條評論