| 123 | } |
| 124 | |
| 125 | const char *MD5Calc::Get() { |
| 126 | MD5_Final(this->md5, &c); |
| 127 | std::stringstream ss; |
| 128 | for (int i = 0; i < MD5_DIGEST_LENGTH; i++) |
| 129 | ss << std::hex << std::setw(2) << std::setfill('0') << (int)this->md5[i]; |
| 130 | this->result = ss.str(); |
| 131 | |
| 132 | // Reset MD5 context |
| 133 | memset(this->md5, 0, MD5_DIGEST_STRING_LENGTH); |
| 134 | MD5_Init(&this->c); |
| 135 | return this->result.c_str(); |
| 136 | } |
| 137 | |
| 138 | #if defined(__clang__) |
| 139 | #pragma clang diagnostic pop |