资源简介
SHA1校验和算法实现,带vs工程源码
代码片段和文件信息
/* sha1sum.c - print SHA-1 Message-Digest Algorithm
* Copyright (C) 1998 1999 2000 2001 Free Software Foundation Inc.
* Copyright (C) 2004 g10 Code GmbH
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software Foundation
* Inc. 59 Temple Place - Suite 330 Boston MA 02111-1307 USA.
*/
/* SHA-1 coden take from gnupg 1.3.92.
Note that this is a simple tool to be used for MS Windows.
*/
#include
#include
#include
#include
#include
#undef BIG_ENDIAN_HOST
typedef unsigned int u32;
/****************
* Rotate a 32 bit integer by n bytes
****************/
#if defined(__GNUC__) && defined(__i386__)
static inline u32 rol( u32 x int n)
{
__asm__(“roll %%cl%0“
:“=r“ (x)
:“0“ (x)“c“ (n));
return x;
}
#else
#define rol(xn) ( ((x) << (n)) | ((x) >> (32-(n))) )
#endif
typedef struct {
u32 h0h1h2h3h4; //哈希计算后的结果是20个bit,刚好相当于5个unsigned int(4字节)类型的数据
u32 nblocks;
unsigned char buf[64];
int count;
} SHA1_CONTEXT;
void sha1_init( SHA1_CONTEXT *hd ) //计算前进行初始化
{
hd->h0 = 0x67452301;
hd->h1 = 0xefcdab89;
hd->h2 = 0x98badcfe;
hd->h3 = 0x10325476;
hd->h4 = 0xc3d2e1f0;
hd->nblocks = 0;
hd->count = 0;
}
/*
* Transform the message X which consists of 16 32-bit-words
*/
static void
transform( SHA1_CONTEXT *hd unsigned char *data )
{
u32 abcdetm;
u32 x[16];
/* get values from the chaining vars */
a = hd->h0;
b = hd->h1;
c = hd->h2;
d = hd->h3;
e = hd->h4;
#ifdef BIG_ENDIAN_HOST
memcpy( x data 64 );
#else
{ int i;
unsigned char *p2;
for(i=0 p2=(unsigned char*)x; i < 16; i++ p2 += 4 ) {
p2[3] = *data++;
p2[2] = *data++;
p2[1] = *data++;
p2[0] = *data++;
}
}
#endif
#define K1 0x5A827999L
#define K2 0x6ED9EBA1L
#define K3 0x8F1BBCDCL
#define K4 0xCA62C1D6L
#define F1(xyz) ( z ^ ( x & ( y ^ z ) ) )
#define F2(xyz) ( x ^ y ^ z )
#define F3(xyz) ( ( x & y ) | ( z & ( x | y ) ) )
#define F4(xyz) ( x ^ y ^ z )
#define M(i) ( tm = x[i&0x0f] ^ x[(i-14)&0x0f] \
^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f] \
(x[i&0x0f] = rol(tm1)) )
#define R(abcdefkm) do { e += rol(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 39936 2016-09-14 18:39 sha1sum\sha1sum\Debug\sha1sum.exe
文件 326476 2016-09-14 18:39 sha1sum\sha1sum\Debug\sha1sum.ilk
文件 371712 2016-09-14 18:39 sha1sum\sha1sum\Debug\sha1sum.pdb
文件 2359296 2016-09-16 21:02 sha1sum\sha1sum\ipch\sha1sum-9070178e\sha1sum-e04e56ae.ipch
文件 672 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\cl.command.1.tlog
文件 2140 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\CL.read.1.tlog
文件 354 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\CL.write.1.tlog
文件 1320 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\li
文件 2428 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\li
文件 624 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\li
文件 22068 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\main.obj
文件 460 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\mt.command.1.tlog
文件 644 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\mt.read.1.tlog
文件 284 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\mt.write.1.tlog
文件 381 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\sha1sum.exe.intermediate.manifest
文件 63 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\sha1sum.lastbuildstate
文件 3155 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\sha1sum.log
文件 52224 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\vc100.idb
文件 69632 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug\vc100.pdb
文件 10667 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\main.cpp
文件 3221 2016-09-14 18:35 sha1sum\sha1sum\sha1sum\sha1sum.vcxproj
文件 953 2016-09-14 18:35 sha1sum\sha1sum\sha1sum\sha1sum.vcxproj.filters
文件 143 2016-09-14 18:34 sha1sum\sha1sum\sha1sum\sha1sum.vcxproj.user
文件 2248704 2016-09-16 21:05 sha1sum\sha1sum\sha1sum.sdf
文件 888 2016-09-14 18:34 sha1sum\sha1sum\sha1sum.sln
..A..H. 18432 2016-09-16 21:05 sha1sum\sha1sum\sha1sum.suo
目录 0 2016-09-16 21:02 sha1sum\sha1sum\ipch\sha1sum-9070178e
目录 0 2016-09-14 18:39 sha1sum\sha1sum\sha1sum\Debug
目录 0 2016-09-14 18:39 sha1sum\sha1sum\Debug
目录 0 2016-09-16 21:02 sha1sum\sha1sum\ipch
............此处省略6个文件信息
相关资源
- GPS d文件转o文件RNXCMP_4.0.4_Windows
- Windows 10 预装应用程序管理工具合集
- windows下perl模块编译文件:dmake
- 用于在离线环境更新Windows证书
- windows资源管理系统 自启工具
- cuda_11.1.0_456.43_win10.exe和cudnn-11.1-wind
- jdk 1.8.0_121 for windows
- MyWindowsService.sln
- Windows 10 镜像
- Windows画板
- 集成usb3.0驱动的Windows2008系统镜像文件
- 集成usb3.0驱动的Windows2008系统镜像文件
- 老版包含windows文件夹的caffe-windows库
- Windows CE 6.0 虚拟串口程序
- vs2010破解版百度链接.rar
- Hadoop 2.7.4 Windows 7 64Bit 编译bin含winut
- windows下的curl64位动态库
- windows下可用的tar
- System.Windows.Forms.dll
- windows环境下hadoop依赖
- Crack_Quartus_Prime_Standard_Pro_16.0_Windows密
- Kinect V2 for windows 体感控制PPT by LSS
- windows+TensorFlow+mask R-CNN
- Qt:Windows编程—DLL注入与卸载 demo
- Windows编程—代码修改系统时间 demo
- qt写的简单的tcp服务器程序代码windo
- hopperDisassembler V4
- windows服务器下监控tomcat系统服务运行
- Win10不需要Cygwin搭建大数据测试环境搭
- WindowsSKD RC.exe
评论
共有 条评论