Lines Matching refs:ctx
75 void md4_starts( md4_context *ctx )
77 ctx->total[0] = 0;
78 ctx->total[1] = 0;
80 ctx->state[0] = 0x67452301;
81 ctx->state[1] = 0xEFCDAB89;
82 ctx->state[2] = 0x98BADCFE;
83 ctx->state[3] = 0x10325476;
86 static void md4_process( md4_context *ctx, const unsigned char data[64] )
109 A = ctx->state[0];
110 B = ctx->state[1];
111 C = ctx->state[2];
112 D = ctx->state[3];
183 ctx->state[0] += A;
184 ctx->state[1] += B;
185 ctx->state[2] += C;
186 ctx->state[3] += D;
192 void md4_update( md4_context *ctx, const unsigned char *input, int ilen )
200 left = ctx->total[0] & 0x3F;
203 ctx->total[0] += ilen;
204 ctx->total[0] &= 0xFFFFFFFF;
206 if( ctx->total[0] < (unsigned long) ilen )
207 ctx->total[1]++;
211 MEMCPY( (void *) (ctx->buffer + left),
213 md4_process( ctx, ctx->buffer );
221 md4_process( ctx, input );
228 MEMCPY( (void *) (ctx->buffer + left),
244 void md4_finish( md4_context *ctx, unsigned char output[16] )
250 high = ( ctx->total[0] >> 29 )
251 | ( ctx->total[1] << 3 );
252 low = ( ctx->total[0] << 3 );
257 last = ctx->total[0] & 0x3F;
260 md4_update( ctx, md4_padding, padn );
261 md4_update( ctx, msglen, 8 );
263 PUT_ULONG_LE( ctx->state[0], output, 0 );
264 PUT_ULONG_LE( ctx->state[1], output, 4 );
265 PUT_ULONG_LE( ctx->state[2], output, 8 );
266 PUT_ULONG_LE( ctx->state[3], output, 12 );
274 md4_context ctx;
276 md4_starts( &ctx );
277 md4_update( &ctx, input, ilen );
278 md4_finish( &ctx, output );