comparison Core/Toolbox.cpp @ 23:62bd05fe4b7c

support for ssl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Aug 2012 10:18:34 +0200
parents 1bc6327d1de3
children 166664f0f860
comparison
equal deleted inserted replaced
22:1bc6327d1de3 23:62bd05fe4b7c
304 throw PalantirException(ErrorCode_InexistentFile); 304 throw PalantirException(ErrorCode_InexistentFile);
305 } 305 }
306 } 306 }
307 307
308 308
309
310 static char GetHexadecimalCharacter(uint8_t value) 309 static char GetHexadecimalCharacter(uint8_t value)
311 { 310 {
312 assert(value < 16); 311 assert(value < 16);
313 312
314 if (value < 10) 313 if (value < 10)
315 return value + '0'; 314 return value + '0';
316 else 315 else
317 return (value - 10) + 'a'; 316 return (value - 10) + 'a';
318 } 317 }
319 318
319
320 void Toolbox::ComputeMD5(std::string& result, 320 void Toolbox::ComputeMD5(std::string& result,
321 const std::string& data) 321 const std::string& data)
322 { 322 {
323 md5_state_s state; 323 md5_state_s state;
324 md5_init(&state); 324 md5_init(&state);
336 for (unsigned int i = 0; i < 16; i++) 336 for (unsigned int i = 0; i < 16; i++)
337 { 337 {
338 result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16); 338 result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16);
339 result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16); 339 result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16);
340 } 340 }
341
342 } 341 }
343 } 342 }