资源简介
将SHA1封装在一个DLL中,方便使用,有源码,(源码用了 作者 - 张鲁夺(zhangluduo)
MSN - zhangluduo@msn.com
QQ群 - 34064264
为所有爱我的人和我爱的人努力!)
我只是封装了下,便于使用以后
调用函数CString GiveSha1(CString filename),filename文件名用\\
代码片段和文件信息
/*
* SHA1.c
*
* Description:
* This file implements the Secure Hashing Algorithm 1 as
* defined in FIPS PUB 180-1 published April 17 1995.
*
* The SHA-1 produces a 160-bit message digest for a given
* data stream. It should take about 2**n steps to find a
* message with the same digest as a given message and
* 2**(n/2) to find any two messages with the same digest
* when n is the digest size in bits. Therefore this
* algorithm can serve as a means of providing a
* “fingerprint“ for a message.
*
* Portability Issues:
* SHA-1 is defined in terms of 32-bit “words“. This code
* uses (included via “sha1.h“ to define 32 and 8
* bit unsigned integer types. If your C compiler does not
* support 32 bit unsigned integers this code is not
* appropriate.
*
* Caveats:
* SHA-1 is designed to work with messages less than 2^64 bits
* long. Although SHA-1 allows a message digest to be generated
* for messages of any number of bits less than 2^64 this
* implementation only works with messages with a length that is
* a multiple of the size of an 8-bit character.
*
*/
/*
Copyright 2006 - 2008
ZhangLuduo
All Rights Reserved.
SHA1算法实现 此份代码参考了RFC3174.txt
对源码略有修改
作者 - 张鲁夺(zhangluduo)
MSN - zhangluduo@msn.com
QQ群 - 34064264
为所有爱我的人和我爱的人努力!
*/
#include “stdafx.h“
#include “SHA1.h“
// Define the SHA1 circular left shift macro
#define SHA1CircularShift(bits word) ((((word) << (bits)) & 0xFFFFFFFF) | ((word) >> (32 - (bits))))
SHA1::SHA1()
{
}
SHA1::~SHA1()
{
}
/** SHA1Reset
Description:
This function will initialize the SHA1Context in preparation
for computing a new SHA1 message digest.
Parameters:
context: [in/out]
The context to reset.
*/
void SHA1::SHA1Reset (SHA1Context* context)
{
context->Length_Low = 0;
context->Length_High = 0;
context->Message_Block_Index = 0;
context->Message_Digest[0] = 0x67452301;
context->Message_Digest[1] = 0xEFCDAB89;
context->Message_Digest[2] = 0x98BADCFE;
context->Message_Digest[3] = 0x10325476;
context->Message_Digest[4] = 0xC3D2E1F0;
context->Computed = 0;
context->Corrupted = 0;
}
/** SHA1Input
Description:
This function accepts an array of octets as the next portion
of the message.
Parameters:
context: [in/out]
The SHA context to update
message_array: [in]
An array of characters representing the next portion of
the message.
length: [in]
The length of the message in message_array
*/
int SHA1::SHA1Input(SHA1Context* context const unsigned char* message_array unsigned length)
{
if (!length || !context || !message_array)
return SHA_NULL;
if (context->Computed)
{
context->Corrupted = SHA_
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2800 2009-10-29 14:50 sha1\SHADLG\SHADLG\ReadMe.txt
文件 21630 2003-04-01 19:36 sha1\SHADLG\SHADLG\res\SHADLG.ico
文件 695 2009-10-29 14:50 sha1\SHADLG\SHADLG\res\SHADLG.manifest
文件 362 2009-10-29 14:50 sha1\SHADLG\SHADLG\res\SHADLG.rc2
文件 862 2009-10-30 09:19 sha1\SHADLG\SHADLG\resource.h
文件 9593 2008-02-23 23:23 sha1\SHADLG\SHADLG\SHA1.cpp
文件 42146 2008-02-23 23:23 sha1\SHADLG\SHADLG\SHA1.h
文件 2958 2009-10-30 08:43 sha1\SHADLG\SHADLG\SHA1Ex.cpp
文件 1488 2009-10-30 08:41 sha1\SHADLG\SHADLG\SHA1Ex.h
文件 58392 2009-10-30 09:19 sha1\SHADLG\SHADLG\SHADLG.APS
文件 1452 2009-10-29 14:50 sha1\SHADLG\SHADLG\SHADLG.cpp
文件 437 2009-10-29 14:50 sha1\SHADLG\SHADLG\SHADLG.h
文件 5251 2009-10-30 09:19 sha1\SHADLG\SHADLG\SHADLG.rc
文件 4921 2009-10-30 08:40 sha1\SHADLG\SHADLG\SHADLG.vcproj
文件 3846 2009-10-30 09:21 sha1\SHADLG\SHADLG\SHADLGDlg.cpp
文件 827 2009-10-30 09:14 sha1\SHADLG\SHADLG\SHADLGDlg.h
文件 143360 2009-10-30 09:21 sha1\SHADLG\SHADLG\shadll.dll
文件 135 2009-10-29 14:50 sha1\SHADLG\SHADLG\stdafx.cpp
文件 1458 2009-10-29 14:50 sha1\SHADLG\SHADLG\stdafx.h
文件 52224 2009-10-30 09:21 sha1\SHADLG\SHADLG.ncb
文件 908 2009-10-29 14:50 sha1\SHADLG\SHADLG.sln
..A..H. 10240 2009-10-30 09:21 sha1\SHADLG\SHADLG.suo
文件 1643 2009-10-30 09:00 sha1\shadll\shadll\ReadMe.txt
文件 373 2009-10-30 09:00 sha1\shadll\shadll\res\shadll.rc2
文件 366 2009-10-30 09:00 sha1\shadll\shadll\Resource.h
文件 9593 2008-02-23 23:23 sha1\shadll\shadll\SHA1.cpp
文件 42146 2008-02-23 23:23 sha1\shadll\shadll\SHA1.h
文件 2958 2009-10-30 08:43 sha1\shadll\shadll\SHA1Ex.cpp
文件 1488 2009-10-30 08:41 sha1\shadll\shadll\SHA1Ex.h
文件 1691 2009-10-30 09:21 sha1\shadll\shadll\shadll.cpp
............此处省略18个文件信息
- 上一篇:触摸按键芯片 TTP226
- 下一篇:labview智能小车小车控制上位机
相关资源
- loadrunner11破解所需的dll和注册表删除
- DNF全自动任务过图源码
- d3d9.dll动态链接库文件
- 简单的二维装箱代码
- msvcp100d.dll和msvcr100d.dll.rar
- 湖南大学计算机组成与结构perflab实验
- 可以直接读写端口的动态链接库:i
- 破解sys_cpt.dll+Quartus_II_11.0_SP1_x64破解器
- hadoop2.6.5对应hadoop.dll、winutils.exe包含
- 不掉血源码
- 汇编10以内的十进制数加法源码
- SHA1withRSA算法不依赖第三方库
- 易语言利用COM对象取网页源码
- DS18B20+UCOSIII-技术资料+源码
- VisualC.NET串口通信及测控应用典型程序
- 安卓医药助手源码
- 小学生四则运算练习系统
- 山寨版qq源码+素材韩顺平
- 坦克大战项目源码+素材韩顺平
- 包含GlU32.Lib glut32.dll glut32.lib glut.dll
- 基于STC12C5A60S2两轮平衡小车程序源码
- 感染型病毒源码
- libcurl相关资源
- 五轴机器人控制器
- SSH购物车项目源码
- hidapi源码以及vs2015编译完成的hidapi.
- SocketTool工具源码
- glutdlls37beta
- unity3d 源代码 Space Game Starter Kit 太空射
- 微信小程序源码-仿京东商城
评论
共有 条评论