C语言编的MD5头文件

/*
  Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  L. Peter Deutsch
  ghost@aladdin.com

*/
/*$Id: md5.h $ */
/*
  Independent implementation of MD5 (RFC 1321).

  This code implements the MD5 Algorithm defined in RFC 1321.
  It is derived directly from the text of the RFC and not from the
  reference implementation.

  The original and principal author of md5.h is L. Peter Deutsch
  <ghost@aladdin.com>.  Other authors are noted in the change history
  that follows (in reverse chronological order):

  1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
  1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
    added conditionalization for C++ compilation from Martin
    Purschke <purschke@bnl.gov>.
  1999-05-03 lpd Original version.
*/

#ifndef md5_INCLUDED
#  define md5_INCLUDED

/*
* This code has some adaptations for the Ghostscript environment, but it
* will compile and run correctly in any environment with 8-bit chars and
* 32-bit ints.  Specifically, it assumes that if the following are
* defined, they have the same meaning as in Ghostscript: P1, P2, P3,
* ARCH_IS_BIG_ENDIAN.
*/

typedef unsigned char md5_byte_t; /* 8-bit byte */
typedef unsigned int md5_word_t; /* 32-bit word */

/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s {
    md5_word_t count[2];    /* message length in bits, lsw first */
    md5_word_t abcd[4];        /* digest buffer */
    md5_byte_t buf[64];        /* accumulate block */
} md5_state_t;

#ifdef __cplusplus
extern "C"
{
#endif

/* Initialize the algorithm. */
#ifdef P1
void md5_init(P1(md5_state_t *pms));
#else
void md5_init(md5_state_t *pms);
#endif

/* Append a string to the message. */
#ifdef P3
void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes));
#else
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
#endif

/* Finish the message and return the digest. */
#ifdef P2
void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16]));
#else
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
#endif

#ifdef __cplusplus
}  /* end extern "C" */
#endif

#endif /* md5_INCLUDED */

时间: 2024-08-01 21:07:39

C语言编的MD5头文件的相关文章

c语言-为什么没包含头文件,却可以使用文件里的函数

问题描述 为什么没包含头文件,却可以使用文件里的函数 在这代码里我没有包含 却可以使用islower()和isupper() #include int main() { int n=0, m=0; char ch; while ((ch = getchar()) != ' ') { if (islower(ch)) n++; else if (isupper(ch)) m++; } printf("The number of lower is %d ", n); printf(&quo

语言-static 函数定义在头文件中有什么作用

问题描述 static 函数定义在头文件中有什么作用 static 函数定义在头文件中有什么作用?学渣求教,static 不就是要限制作用域吗? 解决方案 是限定范围的,你的理解没有错.所以在 .h 中定义的 static 函数只能供本头文件中定义的函数使用 解决方案二: static表示静态类型.同时限定在模块内可见. 解决方案三: static用于声明静态变量,添加了该标识意味着这个变量的值在整个程序运行期间都存在的 解决方案四: static是静态变量.局部变量.其作用域是从定义点到ret

C语言编的MD5主程序

程序 #include <stdio.h>#include <stdlib.h>#include <memory.h>#include <time.h>#include <errno.h>#include <string.h>#include <sys/socket.h>#include <sys/types.h>#include <netinet/in.h>#include <arpa/in

C++中头文件的概念与基本编写方法_C 语言

1 标准库中的头文件C++标准库中的一切内容都被放在名字空间std中(名字空间中的内容对外是不可见的),但是带来了一个新问题,无数现有的C++代码都依赖于使用了多年的伪标准库中的功能,如声明在<iostream.h>等头文件中的功能,使用std包装标准库导致现有代码的不可用,为了兼容这种情况,标准委员会为包装了std的那部分标准库创建了新的头文件,新的头文件的文件名与旧的一样,只是没有.h这个后缀,如<iostream.h>就变成了<iostream>.对于C头文件,采

C语言编程入门之程序头文件的简要解析_C 语言

头文件是扩展名为.h的文件,其中包含C函数的声明和宏定义,也可以多个源文件之间共享.有两种类型的头文件:程序员编写的文件,和编译器中附带的文件. 要求使用头文件的程序,包括通过它,使用C语言预处理指令#include就像所看到的包含stdio.h头文件,它随着编译器自带. 包括一个头文件等于复制头文件的内容,但我们不这样做,因为这很容易出错,一个好主意是我们不复制头文件的内容,特别是包括多个程序的源文件. 在C或C++程序的简单做法是,我们把所有的常量,宏全系统全局变量和函数原型在头文件,其中包

方法-C语言头文件里放声明,其实现放哪?

问题描述 C语言头文件里放声明,其实现放哪? 我写了一个头文件a.h,实现在a.c中,主文件中#include "a.h",报错...我想知道头文件的声明和定义的规范使用方法..谢谢.. 解决方案 首先搞清楚,include和头文件的关系. include的作用是将这个文件的内容插入到include所在的位置,从而构成一个完整的源代码文件被编译. 那么头文件是什么,实际上头文件里可以放任何东西,源代码文件也可以放任何东西,include也可以随意包含. 只是看这三者放在一起,经过替换,

vc-数据结构(c语言)自定义头文件打不开

问题描述 数据结构(c语言)自定义头文件打不开 在vc6.0里面自定义了头文件 #include ""SqList.h"" 然后显示错误D:vc6Microsoft Visual StudioMyProjectscplusshiyabn.cpp(4) : fatal error C1083: Cannot open include file: 'SqList.h': No such file or directory 怎么破? 解决方案 路径不对,用<>

c语言问题-C语言的头文件有包含顺序吗?

问题描述 C语言的头文件有包含顺序吗? C语言的头文件有包含顺序吗?有的话,是什么呀,---------- 解决方案 有包含顺序,即使添加了#ifndef也不一定有用 一个合理的建议:所有的.h中不包含.h,放在CPP中包含.但是每个模块有一个特殊的共通头文件,只用于包含该模块使用的外部的头文件,并且所有的cpp文件必须是最先包含该头文件. 解决方案二: 标注库基本没有包含顺序(差不多都处理掉了), 可以任意使用 但是自己定义的就有了 解决方案三: c语言之头文件包含顺序问题 1.头文件的包含是

c语言-小白求教C语言头文件和源文件的关系

问题描述 小白求教C语言头文件和源文件的关系 书上说头文件一般只有声明,比如void func(void); 函数的定义则是在源文件中,那也就是说我新建的项目要使用以前项目中写过的一些函数(有相关头文件含有它们的声明),光靠把相关头文件#include进来是没用的喽? 可是为什么像stdio.h这样的可以不用包含它的源文件呢? 解决方案 stdio.h的实现在stdlib里,封装起来了,不能通过文本格式打开,防止被修改! 很多函数只提供给你头文件(相当于接口,只给用户使用),而没有具体实现的源代