MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / SHA1Update

Function SHA1Update

tools/websocket_to_posix_proxy/src/sha1.cpp:198–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196/* Run your data through this. */
197
198void SHA1Update(
199 SHA1_CTX * context,
200 const unsigned char *data,
201 uint32_t len
202)
203{
204 uint32_t i;
205
206 uint32_t j;
207
208 j = context->count[0];
209 if ((context->count[0] += len << 3) < j)
210 context->count[1]++;
211 context->count[1] += (len >> 29);
212 j = (j >> 3) & 63;
213 if ((j + len) > 63)
214 {
215 memcpy(&context->buffer[j], data, (i = 64 - j));
216 SHA1Transform(context->state, context->buffer);
217 for (; i + 63 < len; i += 64)
218 {
219 SHA1Transform(context->state, &data[i]);
220 }
221 j = 0;
222 }
223 else
224 i = 0;
225 memcpy(&context->buffer[j], &data[i], len - i);
226}
227
228
229/* Add padding and return the message digest. */

Callers 2

SHA1FinalFunction · 0.85
SHA1Function · 0.85

Calls 2

memcpyFunction · 0.85
SHA1TransformFunction · 0.85

Tested by

no test coverage detected