C-language MD5 header file

Source: Internet
Author: User
Tags header md5 rfc
/*
Copyright (C) 1999 Aladdin Enterprises. All rights reserved.

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

Permission is granted to anyone to the 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 is not misrepresented; Must not
Claim that you wrote the original software. If You use this software
In a product, an acknowledgment in the product documentation would is
Appreciated but is not required.
2. Altered source versions must is plainly marked as such, and must not being
Misrepresented as being the original software.
3. This notice may is removed or altered from the any source distribution.

L. Peter Deutsch
Ghost@aladdin.com

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

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

The original and principal author of Md5.h is L. Peter Deutsch
<ghost@aladdin.com>. The other authors are noted on 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);
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
* 'll compile and run correctly in no 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
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 * *



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.