void IPHeader::setCheckSum() { CheckSum sum; sum(vhl,tos,len,id,flags_offset,ttl,proto.get(),src.get(),dst.get()); check_sum=sum.complete(); }
bool IPHeader::testCheckSum() const { CheckSum sum; sum(vhl,tos,len,id,flags_offset,ttl,proto.get(),check_sum,src.get(),dst.get()); return sum.test(); }
bool ICMPEcho::testCheckSum(PtrLen<const uint8> data) const { CheckSum sum; sum(type.get(),code,check_sum,id,num); sum.add(data); return sum.test(); }
void ICMPEcho::setCheckSum(PtrLen<const uint8> data) { CheckSum sum; sum(type.get(),code,id,num); sum.add(data); check_sum=sum.complete(); }
void UDPHeader::setCheckSum(IPAddress src,IPAddress dst,IPLen len,PtrLen<const uint8> data) { CheckSum sum; uint16 proto=IP_UDP; sum(src.get(),dst.get(),proto,len,src_port,dst_port,len); sum.add(data); check_sum=sum.complete(); }
bool UDPHeader::testCheckSum(IPAddress src,IPAddress dst,IPLen len,PtrLen<const uint8> data) const { if( !check_sum ) return true; CheckSum sum; uint16 proto=IP_UDP; sum(src.get(),dst.get(),proto,len,src_port,dst_port,len,check_sum); sum.add(data); return sum.test(); }
void FileVerifier::AddFileForVerification(char *filename, bool requiredFile) { CheckSum checkSum; FILE *fp; unsigned i; char *fileData; FileWithCheckSum *fwcs; #ifndef WIN32 #define _stat stat #endif struct _stat fileInfo; if (filename==0 || strlen(filename)>=256) { assert(0); return; } if (_stat(filename, &fileInfo)==-1) { printf("File could not be opened: %s\n", filename); return; } printf("File added to verify list: %s\n", filename); fp = fopen(filename, "rb"); #ifdef _DEBUG assert(fp); #endif if (fp==0) return; fileData = new char [fileInfo.st_size]; fread(fileData, 1, fileInfo.st_size, fp); fclose(fp); for (i=0; (int)i < fileInfo.st_size; i++) checkSum.Add((unsigned char)(fileData[i])); delete [] fileData; fwcs=new FileWithCheckSum; strcpy(fwcs->fileName, filename); fwcs->fileIsRequired=requiredFile; fwcs->checkSum=checkSum.Get(); fileList.Insert(fwcs); }
int main(int argc, char *argv[]) { PNMreader reader(argv[1]); Crop crop; crop.SetRegion(300, 1400, 50, 400); crop.SetInput(reader.GetOutput()); Transpose t; t.SetInput(crop.GetOutput()); Invert i; i.SetInput(t.GetOutput()); Color color(50, 1101, 0, 0, 128); LRConcat lr; lr.SetInput(color.GetOutput()); lr.SetInput2(i.GetOutput()); Color white(401, 1101, 255, 255, 255); Checkerboard cb; cb.SetInput(lr.GetOutput()); cb.SetInput2(white.GetOutput()); cb.GetOutput()->Update(); PNMwriter writer; writer.SetInput(cb.GetOutput()); writer.Write(argv[2]); CheckSum cs; cs.SetInput(cb.GetOutput()); cs.OutputCheckSum(); Logger::Finalize(); }
int main(int argc, char *argv[]) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <username>" << endl; exit(EXIT_FAILURE); } char event[1024]; sprintf(event, "Entered program from %s\n", argv[1]); Logger::LogEvent(event); /* START STUDENT MODIFIABLE SECTION */ PNMreader reader("../images/puddles.pnm"); Shrinker shrinker1; Shrinker shrinker2; LRConcat lrconcat1; LRConcat lrconcat2; TBConcat tbconcat1; TBConcat tbconcat2; Checkerboard blender; shrinker1.SetInput(reader.GetOutput()); shrinker2.SetInput2(shrinker1.GetOutput()); lrconcat1.SetInput(shrinker1.GetOutput()); lrconcat1.SetInput2(shrinker2.GetOutput()); tbconcat1.SetInput(shrinker1.GetOutput()); tbconcat2.SetInput2(shrinker2.GetOutput()); blender.SetInput(reader.GetOutput()); blender.SetInput2(tbconcat1.GetOutput()); /* Make the image "finalImage" be the image at the bottom of your pipeline */ Image *finalImage = blender.GetOutput(); /* END STUDENT MODIFIABLE SECTION */ try { finalImage->Update(); } catch (DataFlowException &) { ofstream ofile("my_exception"); if (ofile.fail()) { cerr << "Something is wrong ... can't open my_exception" << " for opening" << endl; exit(EXIT_FAILURE); } ofile << "Exception found!" << endl; exit(EXIT_SUCCESS); } CheckSum cs; cs.SetInput(finalImage); cs.OutputCheckSum("my_checksum"); if (argc == 3) { PNMwriter writer; writer.SetInput(finalImage); writer.Write("3H.pnm"); } Logger::Finalize(); }
int main(int argc, char *argv[]) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <username>" << endl; exit(EXIT_FAILURE); } char event[1024]; sprintf(event, "Entered program from %s\n", argv[1]); Logger::LogEvent(event); /* START STUDENT MODIFIABLE SECTION */ PNMreader reader1("../images/deschutes.pnm"); PNMreader reader2("../images/question_marks.pnm"); PNMreader reader3("../images/puddles.pnm"); Color color1(75, 352, 200, 0, 0); Color color2(75, 352, 0, 0, 200); Color color3(1433, 100, 100, 0, 100); Crop crop1; crop1.SetRegion(0, 356, 0, 351); crop1.SetInput(reader1.GetOutput()); LRConcat LRCon1; LRCon1.SetInput(crop1.GetOutput()); LRCon1.SetInput2(color1.GetOutput()); LRConcat LRCon2; LRCon2.SetInput(color2.GetOutput()); LRCon2.SetInput2(reader2.GetOutput()); Checkerboard blend1; blend1.SetInput(LRCon1.GetOutput()); blend1.SetInput2(LRCon2.GetOutput()); Checkerboard blend2; blend2.SetInput(LRCon1.GetOutput()); blend2.SetInput2(LRCon2.GetOutput()); TBConcat TBCon1; TBCon1.SetInput(blend1.GetOutput()); TBCon1.SetInput2(blend2.GetOutput()); Crop crop2; crop2.SetRegion(0, 1000, 100, 803); crop2.SetInput(reader3.GetOutput()); LRConcat LRCon3; LRCon3.SetInput(TBCon1.GetOutput()); LRCon3.SetInput2(crop2.GetOutput()); TBConcat TBCon2; TBCon2.SetInput(LRCon3.GetOutput()); TBCon2.SetInput2(color3.GetOutput()); Invert invert; invert.SetInput(TBCon2.GetOutput()); TBConcat s1; s1.SetInput(color3.GetOutput()); s1.SetInput2(invert.GetOutput()); /* Make the image "finalImage" be the image at the bottom of your pipeline */ Image *finalImage = s1.GetOutput(); /* END STUDENT MODIFIABLE SECTION */ try { finalImage->Update(); } catch (DataFlowException &) { ofstream ofile("my_exception"); if (ofile.fail()) { cerr << "Something is wrong ... can't open my_exception" << " for opening" << endl; exit(EXIT_FAILURE); } ofile << "Exception found!" << endl; exit(EXIT_SUCCESS); } CheckSum cs; cs.SetInput(finalImage); cs.OutputCheckSum("my_checksum"); if (argc == 3) { PNMwriter writer; writer.SetInput(finalImage); writer.Write("3H.pnm"); } Logger::Finalize(); }
void DataBlockEncryptor::Encrypt( unsigned char *input, int inputLength, unsigned char *output, int *outputLength ) { unsigned index, byteIndex, lastBlock; unsigned long checkSum; unsigned char paddingBytes; unsigned char encodedPad; unsigned char randomChar; CheckSum checkSumCalculator; #ifdef _DEBUG assert( keySet ); #endif assert( input && inputLength ); // randomChar will randomize the data so the same data sent twice will not look the same randomChar = ( unsigned char ) randomMT(); // 16-(((x-1) % 16)+1) // # of padding bytes is 16 -(((input_length + extra_data -1) % 16)+1) paddingBytes = ( unsigned char ) ( 16 - ( ( ( inputLength + sizeof( randomChar ) + sizeof( checkSum ) + sizeof( encodedPad ) - 1 ) % 16 ) + 1 ) ); // Randomize the pad size variable encodedPad = ( unsigned char ) randomMT(); encodedPad <<= 4; encodedPad |= paddingBytes; *outputLength = inputLength + sizeof( randomChar ) + sizeof( checkSum ) + sizeof( encodedPad ) + paddingBytes; // Write the data first, in case we are overwriting ourselves if ( input == output ) memmove( output + sizeof( checkSum ) + sizeof( randomChar ) + sizeof( encodedPad ) + paddingBytes, input, inputLength ); else memcpy( output + sizeof( checkSum ) + sizeof( randomChar ) + sizeof( encodedPad ) + paddingBytes, input, inputLength ); // Write the random char memcpy( output + sizeof( checkSum ), ( char* ) & randomChar, sizeof( randomChar ) ); // Write the pad size variable memcpy( output + sizeof( checkSum ) + sizeof( randomChar ), ( char* ) & encodedPad, sizeof( encodedPad ) ); // Write the padding for ( index = 0; index < paddingBytes; index++ ) *( output + sizeof( checkSum ) + sizeof( randomChar ) + sizeof( encodedPad ) + index ) = ( unsigned char ) randomMT(); // Calculate the checksum on the data checkSumCalculator.add( output + sizeof( checkSum ), inputLength + sizeof( randomChar ) + sizeof( encodedPad ) + paddingBytes ); checkSum = checkSumCalculator.get(); // Write checksum memcpy( output, ( char* ) & checkSum, sizeof( checkSum ) ); // AES on the first block secretKeyAES128.encrypt16( output ); lastBlock = 0; // Now do AES on every other block from back to front for ( index = *outputLength - 16; index >= 16; index -= 16 ) { for ( byteIndex = 0; byteIndex < 16; byteIndex++ ) output[ index + byteIndex ] ^= output[ lastBlock + byteIndex ]; secretKeyAES128.encrypt16( output + index ); lastBlock = index; } }
bool DataBlockEncryptor::Decrypt( unsigned char *input, int inputLength, unsigned char *output, int *outputLength ) { unsigned index, byteIndex, lastBlock; unsigned long checkSum; unsigned char paddingBytes; unsigned char encodedPad; unsigned char randomChar; CheckSum checkSumCalculator; #ifdef _DEBUG assert( keySet ); #endif if ( input == 0 || inputLength < 16 || ( inputLength % 16 ) != 0 ) { return false; } // Unchain in reverse order for ( index = 16; ( int ) index <= inputLength - 16;index += 16 ) { secretKeyAES128.decrypt16( input + index ); for ( byteIndex = 0; byteIndex < 16; byteIndex++ ) { if ( index + 16 == ( unsigned ) inputLength ) input[ index + byteIndex ] ^= input[ byteIndex ]; else input[ index + byteIndex ] ^= input[ index + 16 + byteIndex ]; } lastBlock = index; }; // Decrypt the first block secretKeyAES128.decrypt16( input ); // Read checksum memcpy( ( char* ) & checkSum, input, sizeof( checkSum ) ); // Read the pad size variable memcpy( ( char* ) & encodedPad, input + sizeof( randomChar ) + sizeof( checkSum ), sizeof( encodedPad ) ); // Ignore the high 4 bytes paddingBytes = encodedPad & 0x0F; // Get the data length *outputLength = inputLength - sizeof( randomChar ) - sizeof( checkSum ) - sizeof( encodedPad ) - paddingBytes; // Calculate the checksum on the data. checkSumCalculator.add( input + sizeof( checkSum ), *outputLength + sizeof( randomChar ) + sizeof( encodedPad ) + paddingBytes ); if ( checkSum != checkSumCalculator.get() ) return false; // Read the data if ( input == output ) memmove( output, input + sizeof( randomChar ) + sizeof( checkSum ) + sizeof( encodedPad ) + paddingBytes, *outputLength ); else memcpy( output, input + sizeof( randomChar ) + sizeof( checkSum ) + sizeof( encodedPad ) + paddingBytes, *outputLength ); return true; }
int main(int argc, char *argv[]) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <username>" << endl; exit(EXIT_FAILURE); } char event[1024]; sprintf(event, "Entered program from %s\n", argv[1]); Logger::LogEvent(event); /* START STUDENT MODIFIABLE SECTION */ PNMreader reader("../images/puddles.pnm"); Color color(1786, 1344, 13,255 , 248); Checkerboard b1; b1.SetInput(reader.GetOutput()); b1.SetInput2(color.GetOutput()); Color color2(1786, 1344, 255, 13, 102); Checkerboard b2; b2.SetInput(reader.GetOutput()); b2.SetInput2(color2.GetOutput()); LRConcat l1; l1.SetInput(b1.GetOutput()); l1.SetInput2(b2.GetOutput()); LRConcat l2; l2.SetInput(b2.GetOutput()); l2.SetInput2(b1.GetOutput()); TBConcat t1; t1.SetInput(l1.GetOutput()); t1.SetInput2(l2.GetOutput()); Shrinker s1; s1.SetInput(t1.GetOutput()); Shrinker s2; s2.SetInput(t1.GetOutput()); Shrinker s3; s3.SetInput(t1.GetOutput()); Shrinker s4; s4.SetInput(t1.GetOutput()); Invert i1; i1.SetInput(s2.GetOutput()); Invert i2; i2.SetInput(s4.GetOutput()); LRConcat l3; l3.SetInput(s1.GetOutput()); l3.SetInput2(s2.GetOutput()); LRConcat l4; l4.SetInput(s4.GetOutput()); l4.SetInput2(s3.GetOutput()); TBConcat t2; t2.SetInput(l3.GetOutput()); t2.SetInput2(l4.GetOutput()); Image *finalImage = t2.GetOutput(); /* END STUDENT MODIFIABLE SECTION */ try { finalImage->Update(); } catch (DataFlowException &) { ofstream ofile("my_exception"); if (ofile.fail()) { cerr << "Something is wrong ... can't open my_exception" << " for opening" << endl; exit(EXIT_FAILURE); } ofile << "Exception found!" << endl; exit(EXIT_SUCCESS); } CheckSum cs; cs.SetInput(finalImage); cs.OutputCheckSum("my_checksum"); if (argc == 3) { PNMwriter writer; writer.SetInput(finalImage); writer.Write("3H.pnm"); } Logger::Finalize(); }
int main(int argc, char *argv[]) { if (argc < 2) { cerr << "Usage: " << argv[0] << " <username>" << endl; exit(EXIT_FAILURE); } char event[1024]; sprintf(event, "Entered program from %s\n", argv[1]); Logger::LogEvent(event); /* START STUDENT MODIFIABLE SECTION */ PNMreader reader("../images/hank.pnm"); Checkerboard b; Invert i; i.SetInput(reader.GetOutput()); b.SetInput(reader.GetOutput()); b.SetInput2(i.GetOutput()); LRConcat lr; lr.SetInput(i.GetOutput()); lr.SetInput2(b.GetOutput()); LRConcat LR; LR.SetInput(reader.GetOutput()); LR.SetInput2(i.GetOutput()); TBConcat tb; tb.SetInput(lr.GetOutput()); tb.SetInput2(LR.GetOutput()); LRConcat Lr; Lr.SetInput(tb.GetOutput()); Lr.SetInput2(tb.GetOutput()); Image *finalImage = Lr.GetOutput(); /* END STUDENT MODIFIABLE SECTION */ try { finalImage->Update(); } catch (DataFlowException &) { ofstream ofile("my_exception"); if (ofile.fail()) { cerr << "Something is wrong ... can't open my_exception" << " for opening" << endl; exit(EXIT_FAILURE); } ofile << "Exception found!" << endl; exit(EXIT_SUCCESS); } CheckSum cs; cs.SetInput(finalImage); cs.OutputCheckSum("my_checksum"); if (argc == 3) { PNMwriter writer; writer.SetInput(finalImage); writer.Write("3H.pnm"); } Logger::Finalize(); }
void DataCheck::BeginTurn(void) { CheckSum *check; CivArchive *archive; sint32 i, j; clock_t start, finish; for(i=CRC_TYPE_MIN; i<CRC_TYPE_MAX; i++) for (j=0; j<CRC_ARRAY_MAX; j++) m_old_crc[i][j] = m_crc[i][j]; memset(&m_time, 0, CRC_TYPE_MAX * sizeof(uint32)); start = clock(); archive = new CivArchive(); archive->SetStore(); check = new CheckSum() ; // No idea what was serialized here check->AddData(archive->GetStream(), archive->StreamLen()); check->Done(m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_0], m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_1], m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_2], m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_3]); delete archive; delete check; finish = clock(); m_time[CRC_TYPE_GLOBAL] = finish - start; // should be replaced by: // CHECK_DB(???, CRC_TYPE_GLOBAL); CHECK_DB(g_rand, CRC_TYPE_RAND); start = clock(); archive = new CivArchive(); archive->SetStore(); check = new CheckSum(); // Fill in missing databases g_theAdvanceDB->Serialize(*archive); g_theAdvanceBranchDB->Serialize(*archive); g_theAdvanceListDB->Serialize(*archive); g_theAgeDB->Serialize(*archive); g_theAgeCityStyleDB->Serialize(*archive); g_theBuildListSequenceDB->Serialize(*archive); g_theCitySizeDB->Serialize(*archive); g_theCityStyleDB->Serialize(*archive); g_theCivilisationDB->Serialize(*archive); g_theConstDB->Serialize(*archive); // Old database g_theDifficultyDB->Serialize(*archive); g_theDiplomacyDB->Serialize(*archive); g_theDiplomacyProposalDB->Serialize(*archive); g_theDiplomacyThreatDB->Serialize(*archive); g_theEndGameObjectDB->Serialize(*archive); g_theGoalDB->Serialize(*archive); g_theGovernmentDB->Serialize(*archive); g_theIconDB->Serialize(*archive); g_theImprovementListDB->Serialize(*archive); g_theMapIconDB->Serialize(*archive); g_theMapDB->Serialize(*archive); g_theOrderDB->Serialize(*archive); g_theUVDB->Serialize(*archive); // Old database g_thePersonalityDB->Serialize(*archive); g_thePollutionDB->Serialize(*archive); g_thePopDB->Serialize(*archive); g_theResourceDB->Serialize(*archive); g_theRiskDB->Serialize(*archive); g_theSoundDB->Serialize(*archive); g_theSpecialAttackInfoDB->Serialize(*archive); g_theSpecialEffectDB->Serialize(*archive); g_theSpriteDB->Serialize(*archive); g_theStrategyDB->Serialize(*archive); g_theTerrainDB->Serialize(*archive); g_theUnitDB->Serialize(*archive); g_theUnitBuildListDB->Serialize(*archive); g_theWonderDB->Serialize(*archive); g_theWonderBuildListDB->Serialize(*archive); check->AddData(archive->GetStream(), archive->StreamLen()); check->Done(m_crc[CRC_TYPE_DB][CRC_ARRAY_0], m_crc[CRC_TYPE_DB][CRC_ARRAY_1], m_crc[CRC_TYPE_DB][CRC_ARRAY_2], m_crc[CRC_TYPE_DB][CRC_ARRAY_3]); delete archive; delete check; finish = clock(); m_time[CRC_TYPE_DB] = finish - start; // Continue with single database check start = clock(); archive = new CivArchive(); archive->SetStore(); check = new CheckSum(); // g_theProfileDB->Serialize(*archive); check->AddData(archive->GetStream(), archive->StreamLen()); check->Done(m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_0], m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_1], m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_2], m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_3]); delete archive; delete check; finish = clock(); m_time[CRC_TYPE_PROFILE_DB] = finish - start; start = clock(); archive = new CivArchive(); archive->SetStore(); check = new CheckSum(); // g_theStringDB->Serialize(*archive); check->AddData(archive->GetStream(), archive->StreamLen()); check->Done(m_crc[CRC_TYPE_STRING_DB][CRC_ARRAY_0], m_crc[CRC_TYPE_STRING_DB][CRC_ARRAY_1], m_crc[CRC_TYPE_STRING_DB][CRC_ARRAY_2], m_crc[CRC_TYPE_STRING_DB][CRC_ARRAY_3]); delete archive ; delete check ; finish = clock() ; m_time[CRC_TYPE_STRING_DB] = finish - start; CHECK_DB(g_theAdvanceDB, CRC_TYPE_ADVANCE_DB); CHECK_DB(g_theAdvanceBranchDB, CRC_TYPE_ADVANCE_BRANCH_DB); CHECK_DB(g_theAdvanceListDB, CRC_TYPE_ADVANCE_LIST_DB); CHECK_DB(g_theAgeDB, CRC_TYPE_AGE_DB); CHECK_DB(g_theAgeCityStyleDB, CRC_TYPE_AGE_CITY_STYLE_DB); CHECK_DB(g_theBuildListSequenceDB, CRC_TYPE_BUILD_LIST_SEQUENCE_DB); CHECK_DB(g_theBuildingDB, CRC_TYPE_BUILDING_DB); CHECK_DB(g_theBuildingBuildListDB, CRC_TYPE_BUILDING_BUILD_LIST_DB); CHECK_DB(g_theCitySizeDB, CRC_TYPE_CITY_SIZE_DB); CHECK_DB(g_theCityStyleDB, CRC_TYPE_CITY_STYLE_DB); CHECK_DB(g_theCivilisationDB, CRC_TYPE_CIVILISATION_DB); CHECK_DB(g_theConstDB, CRC_TYPE_CONST_DB); CHECK_DB(g_theDifficultyDB, CRC_TYPE_DIFFICULTY_DB); CHECK_DB(g_theDiplomacyDB, CRC_TYPE_DIPLOMACY_DB); CHECK_DB(g_theDiplomacyProposalDB, CRC_TYPE_DIPLOMACY_PROPOSAL_DB); CHECK_DB(g_theDiplomacyThreatDB, CRC_TYPE_DIPLOMACY_THREAT_DB); CHECK_DB(g_theEndGameObjectDB, CRC_TYPE_END_GAME_OBJECT_DB); CHECK_DB(g_theFeatDB, CRC_TYPE_FEAT_DB); CHECK_DB(g_theGlobalWarmingDB, CRC_TYPE_GLOBAL_WARMING_DB); CHECK_DB(g_theGoalDB, CRC_TYPE_GOAL_DB); CHECK_DB(g_theGovernmentDB, CRC_TYPE_GOVERNMENT_DB); CHECK_DB(g_theIconDB, CRC_TYPE_ICON_DB); CHECK_DB(g_theImprovementListDB, CRC_TYPE_IMPROVEMENT_LIST_DB); CHECK_DB(g_theMapDB, CRC_TYPE_MAP_DB); CHECK_DB(g_theMapIconDB, CRC_TYPE_MAP_ICON_DB); CHECK_DB(g_theOrderDB, CRC_TYPE_ORDER_DB); CHECK_DB(g_theUVDB, CRC_TYPE_OZONE_DB); CHECK_DB(g_thePersonalityDB, CRC_TYPE_PERSONALITY_DB); CHECK_DB(g_thePollutionDB, CRC_TYPE_POLLUTION_DB); CHECK_DB(g_thePopDB, CRC_TYPE_POPULATION_DB); CHECK_DB(g_theResourceDB, CRC_TYPE_RESOURCE_DB); CHECK_DB(g_theRiskDB, CRC_TYPE_RISK_DB); CHECK_DB(g_theSoundDB, CRC_TYPE_SOUND_DB); CHECK_DB(g_theSpecialAttackInfoDB, CRC_TYPE_SPECIAL_ATTACK_INFO_DB); CHECK_DB(g_theSpecialEffectDB, CRC_TYPE_SPECIAL_EFFECT_DB); CHECK_DB(g_theSpriteDB, CRC_TYPE_SPRITE_DB); CHECK_DB(g_theStrategyDB, CRC_TYPE_STRATEGY_DB); CHECK_DB(g_theTerrainDB, CRC_TYPE_TERRAIN_DB); CHECK_DB(g_theUnitDB, CRC_TYPE_UNIT_DB); CHECK_DB(g_theUnitBuildListDB, CRC_TYPE_UNIT_BUILD_LIST_DB); CHECK_DB(g_theWonderDB, CRC_TYPE_WONDER_DB); CHECK_DB(g_theWonderBuildListDB, CRC_TYPE_WONDER_BUILD_LIST_DB); CHECK_DB(g_theAgreementPool, CRC_TYPE_AGREEMENTPOOL); CHECK_DB(g_theCivilisationPool, CRC_TYPE_CIVILISATIONPOOL); CHECK_DB(g_theDiplomaticRequestPool, CRC_TYPE_DIPLOMATICREQUESTPOOL); CHECK_DB(g_theMessagePool, CRC_TYPE_MESSAGEPOOL); CHECK_DB(g_theTerrainImprovementPool, CRC_TYPE_TERRAIN_IMPROVEMENT_POOL); CHECK_DB(g_theTradePool, CRC_TYPE_TRADEPOOL); CHECK_DB(g_theTradeOfferPool, CRC_TYPE_TRADEOFFERPOOL); CHECK_DB(g_theUnitPool, CRC_TYPE_UNITPOOL); CHECK_DB(g_thePollution, CRC_TYPE_POLLUTION); CHECK_DB(g_selected_item, CRC_TYPE_SELECTED_ITEM); CHECK_DB(g_theTopTen, CRC_TYPE_TOPTEN); CHECK_DB(g_theWorld, CRC_TYPE_WORLD); start = clock(); archive = new CivArchive(); archive->SetStore(); check = new CheckSum(); for (i=0; i<k_MAX_PLAYERS; i++) { if(!g_player[i]) continue; g_player[i]->Serialize(*archive); } check->AddData(archive->GetStream(), archive->StreamLen()); check->Done(m_crc[CRC_TYPE_PLAYER][CRC_ARRAY_0], m_crc[CRC_TYPE_PLAYER][CRC_ARRAY_1], m_crc[CRC_TYPE_PLAYER][CRC_ARRAY_2], m_crc[CRC_TYPE_PLAYER][CRC_ARRAY_3]); delete archive; delete check; finish = clock(); m_time[CRC_TYPE_PLAYER] = finish - start ; m_total_time = 0; for(i = 0; i < CRC_ARRAY_MAX; ++i) m_total_time += m_time[i]; }