このグラフは、どのファイルから直接、間接的にインクルードされているかを示しています。
構成 | |
struct | md5_state_s |
型定義 | |
typedef unsigned char | md5_byte_t |
typedef unsigned int | md5_word_t |
typedef md5_state_s | md5_state_t |
関数 | |
void | md5_init (md5_state_t *pms) |
void | md5_append (md5_state_t *pms, const md5_byte_t *data, int nbytes) |
void | md5_finish (md5_state_t *pms, md5_byte_t digest[16]) |
void | md5_finalize (md5_state_t *pms) |
void | md5_get_digest (md5_state_t *pms, md5_byte_t digest[16]) |
void | md5_get_str_digest (md5_state_t *pms, char digest[32+1]) |
Copyright (C) 1999, 2002 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
Independent implementation of MD5 (RFC 1321).
This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted.
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):
2002-04-13 lpd Removed support for non-ANSI compilers; removed references to Ghostscript; clarified derivation from RFC 1321; now handles byte order either statically or dynamically. 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.
This package supports both compile-time and run-time determination of CPU byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is defined as non-zero, the code will be compiled to run only on big-endian CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to run on either big- or little-endian CPUs, but will run slightly less efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
md5.h で定義されています。
|
参照元 md5_append(), md5_finalize(), md5_finish(), md5_get_digest(), md5_get_str_digest(), と md5_process(). |
|
参照元 md5_append(), md5_finalize(), md5_finish(), md5_get_digest(), md5_get_str_digest(), md5_init(), と md5_process(). |
|
参照元 md5_append(), と md5_process(). |
|
Append a string to the message. 参照先 md5_state_s::buf, md5_state_s::count, md5_byte_t, md5_process(), md5_state_t, と md5_word_t. 参照元 dkcMD5LoadStandard(), と md5_finalize().
00321 { 00322 const md5_byte_t *p = data; 00323 int left = nbytes; 00324 int offset = (pms->count[0] >> 3) & 63; 00325 md5_word_t nbits = (md5_word_t)(nbytes << 3); 00326 00327 if (nbytes <= 0) 00328 return; 00329 /* Update the message length. */ 00330 pms->count[1] += nbytes >> 29; 00331 pms->count[0] += nbits; 00332 if (pms->count[0] < nbits) 00333 pms->count[1]++; 00334 /* Process an initial partial block. */ 00335 if (offset) { 00336 int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); 00337 memcpy(pms->buf + offset, p, copy); 00338 if (offset + copy < 64) 00339 return; 00340 p += copy; 00341 left -= copy; 00342 md5_process(pms, pms->buf); 00343 } 00344 /* Process full blocks. */ 00345 for (; left >= 64; p += 64, left -= 64) 00346 md5_process(pms, p); 00347 /* Process a final partial block. */ 00348 if (left) 00349 memcpy(pms->buf, p, left); 00350 } |
|
finalize process 参照先 md5_state_s::count, md5_append(), md5_byte_t, と md5_state_t. 参照元 dkcMD5Final(), と md5_finish().
00364 { 00365 static const md5_byte_t pad[64] = { 00366 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00368 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 00370 }; 00371 md5_byte_t data[8]; 00372 int i; 00373 /* Save the length before padding. */ 00374 for (i = 0; i < 8; ++i){ 00375 data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); 00376 } 00377 /* Pad to 56 bytes mod 64. */ 00378 md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); 00379 /* Append the length. */ 00380 md5_append(pms, data, 8); 00381 } |
|
Finish the message and return the digest. ( md5_finalize() + md5_get_digest() ) 参照先 md5_byte_t, md5_finalize(), md5_get_digest(), と md5_state_t.
00355 { 00356 md5_finalize(pms); 00357 md5_get_digest(pms,digest); 00358 } |
|
get digest binary value 参照先 md5_state_s::abcd, md5_byte_t, と md5_state_t. 参照元 dkcMD5Digest(), md5_finish(), と md5_get_str_digest().
00383 { 00384 int i; 00385 for (i = 0; i < 16; ++i){ 00386 digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); 00387 } 00388 } |
|
get digest strings 参照先 md5_byte_t, md5_get_digest(), と md5_state_t. 参照元 dkcMD5DigestStr().
00390 { 00391 md5_byte_t temp[16]; 00392 int i; 00393 00394 md5_get_digest(pms,temp); 00395 00396 00397 for (i=0; i<16; i++){ 00398 //wsprintf(digest+i*2, "%02x", temp[i]); 00399 sprintf(digest+i*2,"%02x", temp[i]); 00400 } 00401 digest[32]='\0'; 00402 } |
|
Initialize the algorithm. 参照先 md5_state_s::abcd, md5_state_s::count, md5_state_t, と T_MASK. 参照元 dkcMD5Init().
|