MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / sha1_process_rar29

Function sha1_process_rar29

Libraries/unrar/sha1.cpp:146–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145
146void sha1_process_rar29(sha1_context *context, const unsigned char *data, size_t len)
147{
148 size_t i, j = (size_t)(context->count & 63);
149 context->count += len;
150
151 if ((j + len) > 63)
152 {
153 memcpy(context->buffer+j, data, (i = 64-j));
154 uint32 workspace[16];
155 SHA1Transform(context->state, workspace, context->buffer, true);
156 for ( ; i + 63 < len; i += 64)
157 {
158 SHA1Transform(context->state, workspace, data+i, false);
159 for (uint k = 0; k < 16; k++)
160 RawPut4(workspace[k],(void*)(data+i+k*4));
161 }
162 j = 0;
163 }
164 else
165 i = 0;
166 if (len > i)
167 memcpy(context->buffer+j, data+i, len - i);
168}
169
170
171/* Add padding and return the message digest. */

Callers 1

SetKey30Method · 0.85

Calls 2

SHA1TransformFunction · 0.85
RawPut4Function · 0.85

Tested by

no test coverage detected