return latest hash as 32 hex characters
| 321 | |
| 322 | /// return latest hash as 32 hex characters |
| 323 | std::string MD5::getHash() |
| 324 | { |
| 325 | // compute hash (as raw bytes) |
| 326 | unsigned char rawHash[HashBytes]; |
| 327 | getHash( rawHash ); |
| 328 | |
| 329 | // convert to hex string |
| 330 | std::string result; |
| 331 | result.reserve( 2 * HashBytes ); |
| 332 | for( int i = 0; i < HashBytes; i++ ) |
| 333 | { |
| 334 | static const char dec2hex[16 + 1] = "0123456789abcdef"; |
| 335 | result += dec2hex[( rawHash[i] >> 4 ) & 15]; |
| 336 | result += dec2hex[rawHash[i] & 15]; |
| 337 | } |
| 338 | |
| 339 | return result; |
| 340 | } |
| 341 | |
| 342 | |
| 343 | /// return latest hash as bytes |