mbdriver/src/util.cxx
//=====================================================================
//Uses MD5 message digest algorithm to calculate checksum.
//
Uses MD5 message digest algorithm to calculate checksum.
Uses MD5 message digest algorithm to calculate checksum .
static unsigned int calculate_checksum(const string& filepath, const string& model_dir_path)
{
    MD5_CTX context;
    MD5Init(&context);
    unsigned int len = filepath.length();
    MD5Update(&context, (unsigned char *)filepath.c_str(), len);
    len = model_dir_path.length();
    MD5Update(&context, (unsigned char *)model_dir_path.c_str(), len);
    unsigned char digest[16];
    MD5Final(digest, &context);
    unsigned int check_sum = digest[0];
    return check_sum;
}
static unsigned int calculate_checksum ( const string & filepath , const string & model_dir_path ) { MD5_CTX context ; MD5Init ( & context ) ; unsigned int len = filepath . length ( ) ; MD5Update ( & context , ( unsigned char * ) filepath . c_str ( ) , len ) ; len = model_dir_path . length ( ) ; MD5Update ( & context , ( unsigned char * ) model_dir_path . c_str ( ) , len ) ; unsigned char digest [ 16 ] ; MD5Final ( digest , & context ) ; unsigned int check_sum = digest [ 0 ] ; return check_sum ; }
Uses MD5 message digest algorithm to calculate checksum.
Uses MD5 message digest algorithm to calculate checksum .
//Initialize checksum context //Caculate checksum //return only the first byte (sufficient for now...)