- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
QString convToHex( unsigned char *bytes, int size )
{
if( size > 16 )
size = 16;
QString ret;
for( int i = 0; i < size; i++ )
{
char buf[64];
::snprintf( buf, sizeof(buf), "%02x", (unsigned int) bytes[i] );
ret += buf;
}
return ret;
}
QString TarCreator::generateGuid( const std::string &tDeviceSerial,
const std::string &nDatetime, unsigned long long int id )
{
std::ostringstream s;
s << tDeviceSerial;
s << nDatetime;
s << id;
QCryptographicHash hash( QCryptographicHash::Md5 );
hash.addData( QByteArray( s.str().c_str() ) );
QByteArray result = hash.result();
return convToHex( (unsigned char*)result.data(), result.size() );
}
Lure Of Chaos 08.02.2011 16:31 # 0