MCPcopy Create free account
hub / github.com/assaultcube/AC / hash_incremental

Function hash_incremental

source/src/crypto.cpp:125–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123 }
124
125 void hash_incremental(const uchar *msg, int len, hashval &val, incremental_buffer *b)
126 {
127 ASSERT(b && b->len >= 0 && b->len < 64);
128 b->total += len;
129 while(b->len + len >= 64)
130 {
131 if(b->len > 0)
132 { // fill up buffer and compress
133 int fill = 64 - b->len;
134 memcpy(b->u + b->len, msg, fill);
135 compress(b->c, val.chunks);
136 b->len = 0;
137 len -= fill;
138 msg += fill;
139 }
140 else
141 { // compress directly from msg
142 compress((chunk *)msg, val.chunks);
143 len -= 64;
144 msg += 64;
145 }
146 }
147 if(len > 0)
148 { // pur rest in buffer
149 memcpy(b->u + b->len, msg, len);
150 b->len += len;
151 }
152 }
153
154 void hash_finish(hashval &val, incremental_buffer *b)
155 {

Callers 1

tigerhash_addFunction · 0.85

Calls 1

compressFunction · 0.85

Tested by

no test coverage detected