Lines Matching refs:context
34 PHP_SHA1_CTX context; in PHP_FUNCTION() local
43 PHP_SHA1Init(&context); in PHP_FUNCTION()
44 PHP_SHA1Update(&context, (unsigned char *) ZSTR_VAL(arg), ZSTR_LEN(arg)); in PHP_FUNCTION()
45 PHP_SHA1Final(digest, &context); in PHP_FUNCTION()
66 PHP_SHA1_CTX context; in PHP_FUNCTION() local
81 PHP_SHA1Init(&context); in PHP_FUNCTION()
84 PHP_SHA1Update(&context, buf, n); in PHP_FUNCTION()
87 PHP_SHA1Final(digest, &context); in PHP_FUNCTION()
155 PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context) in PHP_SHA1Init() argument
157 context->count[0] = context->count[1] = 0; in PHP_SHA1Init()
160 context->state[0] = 0x67452301; in PHP_SHA1Init()
161 context->state[1] = 0xefcdab89; in PHP_SHA1Init()
162 context->state[2] = 0x98badcfe; in PHP_SHA1Init()
163 context->state[3] = 0x10325476; in PHP_SHA1Init()
164 context->state[4] = 0xc3d2e1f0; in PHP_SHA1Init()
173 PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, in PHP_SHA1Update() argument
179 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); in PHP_SHA1Update()
182 if ((context->count[0] += ((uint32_t) inputLen << 3)) in PHP_SHA1Update()
184 context->count[1]++; in PHP_SHA1Update()
185 context->count[1] += ((uint32_t) inputLen >> 29); in PHP_SHA1Update()
193 ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); in PHP_SHA1Update()
194 SHA1Transform(context->state, context->buffer); in PHP_SHA1Update()
197 SHA1Transform(context->state, &input[i]); in PHP_SHA1Update()
205 ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], in PHP_SHA1Update()
214 PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context) in PHP_SHA1Final() argument
220 bits[7] = context->count[0] & 0xFF; in PHP_SHA1Final()
221 bits[6] = (context->count[0] >> 8) & 0xFF; in PHP_SHA1Final()
222 bits[5] = (context->count[0] >> 16) & 0xFF; in PHP_SHA1Final()
223 bits[4] = (context->count[0] >> 24) & 0xFF; in PHP_SHA1Final()
224 bits[3] = context->count[1] & 0xFF; in PHP_SHA1Final()
225 bits[2] = (context->count[1] >> 8) & 0xFF; in PHP_SHA1Final()
226 bits[1] = (context->count[1] >> 16) & 0xFF; in PHP_SHA1Final()
227 bits[0] = (context->count[1] >> 24) & 0xFF; in PHP_SHA1Final()
231 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); in PHP_SHA1Final()
233 PHP_SHA1Update(context, PADDING, padLen); in PHP_SHA1Final()
236 PHP_SHA1Update(context, bits, 8); in PHP_SHA1Final()
239 SHA1Encode(digest, context->state, 20); in PHP_SHA1Final()
243 ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context)); in PHP_SHA1Final()