| 124 | } |
| 125 | |
| 126 | void MD5Digest::Update(const void* pData, u32 cbData) |
| 127 | { |
| 128 | u32 t; |
| 129 | const u8* pByteData = reinterpret_cast<const u8*>(pData); |
| 130 | |
| 131 | /* Update bitcount */ |
| 132 | |
| 133 | t = this->bits[0]; |
| 134 | if ((this->bits[0] = t + ((u32)cbData << 3)) < t) |
| 135 | this->bits[1]++; /* Carry from low to high */ |
| 136 | this->bits[1] += cbData >> 29; |
| 137 | |
| 138 | t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ |
| 139 | |
| 140 | /* Handle any leading odd-sized chunks */ |
| 141 | |
| 142 | if (t) |
| 143 | { |
| 144 | u8* p = (u8*)this->in + t; |
| 145 | |
| 146 | t = 64 - t; |
| 147 | if (cbData < t) |
| 148 | { |
| 149 | std::memcpy(p, pByteData, cbData); |
| 150 | return; |
| 151 | } |
| 152 | std::memcpy(p, pByteData, t); |
| 153 | MD5Transform(this->buf, (u32*)this->in); |
| 154 | pByteData += t; |
| 155 | cbData -= t; |
| 156 | } |
| 157 | /* Process data in 64-byte chunks */ |
| 158 | |
| 159 | while (cbData >= 64) |
| 160 | { |
| 161 | std::memcpy(this->in, pByteData, 64); |
| 162 | MD5Transform(this->buf, (u32*)this->in); |
| 163 | pByteData += 64; |
| 164 | cbData -= 64; |
| 165 | } |
| 166 | |
| 167 | /* Handle any remaining bytes of data. */ |
| 168 | |
| 169 | std::memcpy(this->in, pByteData, cbData); |
| 170 | } |
| 171 | |
| 172 | void MD5Digest::Final(u8 Digest[16]) |
| 173 | { |
nothing calls this directly
no test coverage detected