资源简介
要不给你看看我写的sha1的源码,这是我写的sha1源码
代码片段和文件信息
/*$6
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#include
#include “sha1.h“
#define SHA1HANDSOFF
#define rol(value bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* blk0() and blk() perform the initial expand. */
/* I got the idea of expanding during the round function from SSLeay */
#if BYTE_ORDER == LITTLE_ENDIAN
#define blk0(i) (block->l[i] = (rol(block->l[i]24)&0xFF00FF00) \
|(rol(block->l[i]8)&0x00FF00FF))
#else
#define blk0(i) block->l[i]
#endif
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
^block->l[(i+2)&15]^block->l[i&15]1))
/* (R0+R1) R2 R3 R4 are the different operations used in SHA1 */
#define R0(vwxyzi) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v5);w=rol(w30);
#define R1(vwxyzi) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v5);w=rol(w30);
#define R2(vwxyzi) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v5);w=rol(w30);
#define R3(vwxyzi) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v5);w=rol(w30);
#define R4(vwxyzi) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v5);w=rol(w30);
/* Hash a single 512-bit block. This is the core of the algorithm. */
void SHA1Transform(unsigned long state[5] unsigned char buffer[64])
{
unsigned long a b c d e;
typedef union {
unsigned char c[64];
unsigned long l[16];
} CHAR64LONG16;
CHAR64LONG16* block;
#ifdef SHA1HANDSOFF
static unsigned char workspace[64];
block = (CHAR64LONG16*)workspace;
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(bcdea 4); R0(abcde 5); R0(eabcd 6); R0(deabc 7);
R0(cdeab 8); R0(bcdea 9); R0(abcde10); R0(eabcd11);
R0(deabc12); R0(cdeab13); R0(bcdea14); R0(abcde15);
R1(eabcd16); R1(deabc17); R1(cdeab18); R1(bcdea19);
R2(abcde20); R2(eabcd21); R2(deabc22); R2(cdeab23);
R2(bcdea24); R2(abcde25); R2(eabcd26); R2(deabc27);
R2(cdeab28); R2(bcdea29); R2(abcde30); R2(eabcd31);
R2(deabc32); R2(cdeab33); R2(bcdea34); R2(abcde35);
R2(eabcd36); R2(deabc37); R2(cdeab38); R2(bcdea39);
R3(abcde40); R3(eabcd41); R3(deabc42); R3(cdeab43);
R3(bcdea44); R3(abcde45); R3(eabcd46); R3(deabc47);
R3(cdeab48); R3(bcdea49); R3(abcde50); R3(eabcd51);
R3(deabc52); R3(c
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6045 2014-10-24 20:23 sha1\sha1.c
文件 1016 2014-10-24 20:23 sha1\sha1.h
目录 0 2014-10-26 16:26 sha1
----------- --------- ---------- ----- ----
7061 3
- 上一篇:lmd程序
- 下一篇:HMC5883_CC2530
相关资源
- linux ov5640驱动源码
- 数据结构 joseph环 含源代码
- 易语言双色球号码筛选器源码
- 漂亮的安卓课程表+源码
- 基于Qt的坦克大战游戏源码
- 3DS文件导入OpenGL并动态显示源码
- 微擎开发相关视屏、文档、工具、微
- delphi XE4 超完美破解 注册机
- DS18B20温度传感器源码
- 仿论坛源码手机端
- qt黑白棋源码简单
- 易语言商务UI界面源码
- 抖音直播采集源码
- 舔狗日记源码舔狗日记源码舔狗日记
- 外卖订餐系统源码
- 一机一码加密程序易语言源码
- 坦克大战游戏源码素材文档.zip
- builtin_shaders-2017.4.8f1.zip
- 按行随机打乱文本文件(xe3)
- 易语言源码金税盘开票助手易语言源
- 基于数据报套接字的回射程序设计与
- 基于QT和OpenCV的五子棋实现源码
- 易语言 仿WPE源码
- Graphcut-源码及实现
- telnet 客户端和服务端源代码
- 小记账本源码
- 博客《FlowLayout详解二——FlowLayout实现
- 冒险岛吸怪无敌 源码
- g2o源码阅读.docx
- c primer plus 第六版源码及习题参考代码
评论
共有 条评论