sum-md5.c revision 1
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1996-2011 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* md5
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Method" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Method" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
*/
#define md5_description \
"The RSA Data Security, Inc. MD5 Message-Digest Method, 1991-2, \
used with permission. The block count is not printed."
#define md5_options "[+(version)?md5 (RSA Data Security, Inc. MD5 Message-Digest, 1991-2) 1996-02-29]"
#define md5_match "md5|MD5"
#define md5_scale 0
typedef struct Md5_s
{
} Md5_t;
static const unsigned char md5_pad[] =
{
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/*
* encode input into output
* len must be a multiple of 4
*/
static void
{
register unsigned int i;
register unsigned int j;
for (i = j = 0; j < len; i++, j += 4)
{
}
}
/*
* decode input into output
* len must be a multiple of 4
*/
static void
{
unsigned int i;
unsigned int j;
for (i = j = 0; j < len; i++, j += 4)
}
static int
{
return 0;
}
static Sum_t*
{
Md5_t* p;
{
}
return (Sum_t*)p;
}
/*
* basic MD5 step -- transforms buf based on in
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
/* F, G, H and I are basic MD5 functions */
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits */
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
/* Rotation is separate from addition to prevent recomputation */
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
static void
{
UINT4 x[16];
/* round 1 */
/* round 2 */
/* round 3 */
/* round 4 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
}
static int
{
unsigned char* input = (unsigned char*)s;
unsigned int i;
unsigned int index;
unsigned int partLen;
/* compute number of bytes mod 64 */
/* update number of bits */
/* transform as many times as possible */
{
index = 0;
}
else
i = 0;
/* buffer remaining input */
return 0;
}
static int
{
unsigned char bits[8];
unsigned int index;
unsigned int padLen;
/* save number of bits */
/* pad out to 56 mod 64 */
/* append length (before padding) */
/* store state in digest */
/* accumulate the digests */
return 0;
}
static int
{
register unsigned char* d;
register int n;
for (n = 0; n < elementsof(x->digest); n++)
return 0;
}
static int
{
return 0;
}