MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / Final

Method Final

common/MD5Digest.cpp:172–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void MD5Digest::Final(u8 Digest[16])
173{
174 u32 count;
175 u8* p;
176
177 /* Compute number of bytes mod 64 */
178 count = (this->bits[0] >> 3) & 0x3F;
179
180 /* Set the first char of padding to 0x80. This is safe since there is
181 always at least one byte free */
182 p = this->in + count;
183 *p++ = 0x80;
184
185 /* Bytes of padding needed to make 64 bytes */
186 count = 64 - 1 - count;
187
188 /* Pad out to 56 mod 64 */
189 if (count < 8)
190 {
191 /* Two lots of padding: Pad the first block to 64 bytes */
192 std::memset(p, 0, count);
193 MD5Transform(this->buf, (u32*)this->in);
194
195 /* Now fill the next block with 56 bytes */
196 std::memset(this->in, 0, 56);
197 }
198 else
199 {
200 /* Pad block to 56 bytes */
201 std::memset(p, 0, count - 8);
202 }
203
204 /* Append length in bits and transform */
205 ((u32*)this->in)[14] = this->bits[0];
206 ((u32*)this->in)[15] = this->bits[1];
207
208 MD5Transform(this->buf, (u32*)this->in);
209 std::memcpy(Digest, this->buf, 16);
210}

Callers 7

GetGameHashMethod · 0.80
ComputeTrackHashMethod · 0.80
GetCacheKeyMethod · 0.80
GetShaderCacheKeyMethod · 0.80
GetPipelineCacheKeyMethod · 0.80
GetCacheKeyMethod · 0.80
GetCacheKeyMethod · 0.80

Calls 1

MD5TransformFunction · 0.85

Tested by

no test coverage detected