include/md5.h

ソースコードを見る。

データ構造

struct  MD5Context

関数

void MD5Init (struct MD5Context *context)
void MD5Update (struct MD5Context *context, unsigned char const *buf, unsigned len)
void MD5Final (unsigned char digest[16], struct MD5Context *context)


関数

void MD5Init ( struct MD5Context context  ) 

md5.c45 行で定義されています。

参照先 ctx.

参照元 calc_ntlmv2_key()creds_init_128()E_md5hash()encode_or_decode_arc4_passwd_buffer()hmac_md5_final()hmac_md5_init_limK_to_64()hmac_md5_init_rfc2104()netdom_join_domain()ntlmssp_client_challenge()ntlmssp_server_auth()simple_packet_signature().

00046 {
00047     ctx->buf[0] = 0x67452301;
00048     ctx->buf[1] = 0xefcdab89;
00049     ctx->buf[2] = 0x98badcfe;
00050     ctx->buf[3] = 0x10325476;
00051 
00052     ctx->bits[0] = 0;
00053     ctx->bits[1] = 0;
00054 }

void MD5Update ( struct MD5Context context,
unsigned char const *  buf,
unsigned  len 
)

md5.c60 行で定義されています。

参照先 byteReverse()ctxMD5Transform()t.

参照元 calc_ntlmv2_key()creds_init_128()E_md5hash()encode_or_decode_arc4_passwd_buffer()hmac_md5_final()hmac_md5_init_limK_to_64()hmac_md5_init_rfc2104()hmac_md5_update()netdom_join_domain()ntlmssp_client_challenge()ntlmssp_server_auth()simple_packet_signature().

00061 {
00062     register uint32 t;
00063 
00064     /* Update bitcount */
00065 
00066     t = ctx->bits[0];
00067     if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
00068         ctx->bits[1]++;         /* Carry from low to high */
00069     ctx->bits[1] += len >> 29;
00070 
00071     t = (t >> 3) & 0x3f;        /* Bytes already in shsInfo->data */
00072 
00073     /* Handle any leading odd-sized chunks */
00074 
00075     if (t) {
00076         unsigned char *p = (unsigned char *) ctx->in + t;
00077 
00078         t = 64 - t;
00079         if (len < t) {
00080             memmove(p, buf, len);
00081             return;
00082         }
00083         memmove(p, buf, t);
00084         byteReverse(ctx->in, 16);
00085         MD5Transform(ctx->buf, (uint32 *) ctx->in);
00086         buf += t;
00087         len -= t;
00088     }
00089     /* Process data in 64-byte chunks */
00090 
00091     while (len >= 64) {
00092         memmove(ctx->in, buf, 64);
00093         byteReverse(ctx->in, 16);
00094         MD5Transform(ctx->buf, (uint32 *) ctx->in);
00095         buf += 64;
00096         len -= 64;
00097     }
00098 
00099     /* Handle any remaining bytes of data. */
00100 
00101     memmove(ctx->in, buf, len);
00102 }

void MD5Final ( unsigned char  digest[16],
struct MD5Context context 
)

md5.c108 行で定義されています。

参照先 byteReverse()ctxMD5Transform().

参照元 calc_ntlmv2_key()creds_init_128()E_md5hash()encode_or_decode_arc4_passwd_buffer()hmac_md5_final()hmac_md5_init_rfc2104()netdom_join_domain()ntlmssp_client_challenge()ntlmssp_server_auth()simple_packet_signature().

00109 {
00110     unsigned int count;
00111     unsigned char *p;
00112 
00113     /* Compute number of bytes mod 64 */
00114     count = (ctx->bits[0] >> 3) & 0x3F;
00115 
00116     /* Set the first char of padding to 0x80.  This is safe since there is
00117        always at least one byte free */
00118     p = ctx->in + count;
00119     *p++ = 0x80;
00120 
00121     /* Bytes of padding needed to make 64 bytes */
00122     count = 64 - 1 - count;
00123 
00124     /* Pad out to 56 mod 64 */
00125     if (count < 8) {
00126         /* Two lots of padding:  Pad the first block to 64 bytes */
00127         memset(p, 0, count);
00128         byteReverse(ctx->in, 16);
00129         MD5Transform(ctx->buf, (uint32 *) ctx->in);
00130 
00131         /* Now fill the next block with 56 bytes */
00132         memset(ctx->in, 0, 56);
00133     } else {
00134         /* Pad block to 56 bytes */
00135         memset(p, 0, count - 8);
00136     }
00137     byteReverse(ctx->in, 14);
00138 
00139     /* Append length in bits and transform */
00140     ((uint32 *) ctx->in)[14] = ctx->bits[0];
00141     ((uint32 *) ctx->in)[15] = ctx->bits[1];
00142 
00143     MD5Transform(ctx->buf, (uint32 *) ctx->in);
00144     byteReverse((unsigned char *) ctx->buf, 4);
00145     memmove(digest, ctx->buf, 16);
00146     memset(ctx, 0, sizeof(ctx));        /* In case it's sensitive */
00147 }


Sambaに対してSat Aug 29 21:23:34 2009に生成されました。  doxygen 1.4.7