Lines Matching +full:- +full:z
3 * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
24 * md5_vector - MD5 hash for data vector
29 * Returns: 0 on success, -1 of failure
37 return -1; in md5_vector()
47 /* ===== start - public domain MD5 implementation ===== */
49 * This code implements the MD5 message-digest algorithm.
62 * will fill a supplied 16-byte array with the digest.
69 * Note: this code is harmless on little-endian machines.
79 } while (--longs); in byteReverse()
89 ctx->buf[0] = 0x67452301; in MD5Init()
90 ctx->buf[1] = 0xefcdab89; in MD5Init()
91 ctx->buf[2] = 0x98badcfe; in MD5Init()
92 ctx->buf[3] = 0x10325476; in MD5Init()
94 ctx->bits[0] = 0; in MD5Init()
95 ctx->bits[1] = 0; in MD5Init()
108 t = ctx->bits[0]; in MD5Update()
109 if ((ctx->bits[0] = t + ((u32) len << 3)) < t) in MD5Update()
110 ctx->bits[1]++; /* Carry from low to high */ in MD5Update()
111 ctx->bits[1] += len >> 29; in MD5Update()
113 t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ in MD5Update()
115 /* Handle any leading odd-sized chunks */ in MD5Update()
118 unsigned char *p = (unsigned char *) ctx->in + t; in MD5Update()
120 t = 64 - t; in MD5Update()
126 byteReverse(ctx->in, 16); in MD5Update()
127 MD5Transform(ctx->buf, (u32 *) ctx->in); in MD5Update()
129 len -= t; in MD5Update()
131 /* Process data in 64-byte chunks */ in MD5Update()
134 os_memcpy(ctx->in, buf, 64); in MD5Update()
135 byteReverse(ctx->in, 16); in MD5Update()
136 MD5Transform(ctx->buf, (u32 *) ctx->in); in MD5Update()
138 len -= 64; in MD5Update()
143 os_memcpy(ctx->in, buf, len); in MD5Update()
147 * Final wrapup - pad to 64-byte boundary with the bit pattern
148 * 1 0* (64-bit count of bits processed, MSB-first)
156 count = (ctx->bits[0] >> 3) & 0x3F; in MD5Final()
160 p = ctx->in + count; in MD5Final()
164 count = 64 - 1 - count; in MD5Final()
170 byteReverse(ctx->in, 16); in MD5Final()
171 MD5Transform(ctx->buf, (u32 *) ctx->in); in MD5Final()
174 os_memset(ctx->in, 0, 56); in MD5Final()
177 os_memset(p, 0, count - 8); in MD5Final()
179 byteReverse(ctx->in, 14); in MD5Final()
182 ((u32 *) aliasing_hide_typecast(ctx->in, u32))[14] = ctx->bits[0]; in MD5Final()
183 ((u32 *) aliasing_hide_typecast(ctx->in, u32))[15] = ctx->bits[1]; in MD5Final()
185 MD5Transform(ctx->buf, (u32 *) ctx->in); in MD5Final()
186 byteReverse((unsigned char *) ctx->buf, 4); in MD5Final()
187 os_memcpy(digest, ctx->buf, 16); in MD5Final()
191 /* The four core functions - F1 is optimized somewhat */
193 /* #define F1(x, y, z) (x & y | ~x & z) */
194 #define F1(x, y, z) (z ^ (x & (y ^ z))) argument
195 #define F2(x, y, z) F1(z, x, y) argument
196 #define F3(x, y, z) (x ^ y ^ z) argument
197 #define F4(x, y, z) (y ^ (x | ~z)) argument
200 #define MD5STEP(f, w, x, y, z, data, s) \ argument
201 ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
290 /* ===== end - public domain MD5 implementation ===== */