| 51 | } |
| 52 | |
| 53 | std::array<uint8_t, 16> HashMD5::getHashAndReset() |
| 54 | { |
| 55 | unsigned char buf[EVP_MAX_MD_SIZE]; |
| 56 | unsigned int nwritten = sizeof(buf); |
| 57 | // it also resets the context |
| 58 | int ret = EVP_DigestFinal(pimpl->ctx, buf, &nwritten); |
| 59 | NVCV_ASSERT(ret == 1); |
| 60 | |
| 61 | // Be ready for a new run |
| 62 | ret = EVP_DigestInit_ex(pimpl->ctx, EVP_md5(), NULL); |
| 63 | NVCV_ASSERT(ret == 1); |
| 64 | |
| 65 | NVCV_ASSERT(nwritten == 16); |
| 66 | std::array<uint8_t, 16> hash; |
| 67 | memcpy(&hash[0], buf, sizeof(hash)); |
| 68 | return hash; |
| 69 | } |
| 70 | |
| 71 | void Update(HashMD5 &hash, const char *value) |
| 72 | { |
no outgoing calls