MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / finalize

Method finalize

extern/md5/md5.cpp:179–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178
179void MD5::finalize (){
180
181 unsigned char bits[8];
182 unsigned int index, padLen;
183 static uint1 PADDING[64]={
184 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
187 };
188
189 if (finalized){
190 cerr << "MD5::finalize: Already finalized this digest!" << endl;
191 return;
192 }
193
194 // Save number of bits
195 encode (bits, count, 8);
196
197 // Pad out to 56 mod 64.
198 index = (uint4) ((count[0] >> 3) & 0x3f);
199 padLen = (index < 56) ? (56 - index) : (120 - index);
200 update (PADDING, padLen);
201
202 // Append length (before padding)
203 update (bits, 8);
204
205 // Store state in digest
206 encode (digest, state, 16);
207
208 // Zeroize sensitive information
209 memset (buffer, 0, sizeof(*buffer));
210
211 finalized=1;
212
213}
214
215
216

Callers 1

readSparseMatrixMethod · 0.45

Calls 1

updateFunction · 0.85

Tested by

no test coverage detected