c++ - Boost CRC problem: different results with the same parameters -


I am using CRC for the first time ( boost :: crc_32_type ), and I saw Call that the call process_bytes () method gets twice the results with the same criteria, is it normal?

  #include & lt; Boost / crc.hpp & gt; # Include & lt; IOS & gt; // for std :: ios_base, etc #include & lt; Iostream & gt; #include & lt; String & gt; using namespace std; Int main () {string data1, data2; Boost :: crc_32_type Results 1, result 2; Data1 = "This is a test string"; Data2 = Data 1; Result1.process_bytes (data1.c_str (), data 1. lamps ()); Cout & lt; & Lt; "Results 1:" & lt; & Lt; Hex & lt; & Lt; Uppercase & lt; & Lt; Results 1. Check () & lt; & Lt; Endl; Result1.process_bytes (data1.c_str (), data 1. lamps ()); Cout & lt; & Lt; "Results 1:" & lt; & Lt; Hex & lt; & Lt; Uppercase & lt; & Lt; Results 1. Check () & lt; & Lt; Endl; Result2.process_bytes (data1.c_str (), data 1. lamps ()); Cout & lt; & Lt; "Results 2:" & lt; & Lt; Hex & lt; & Lt; Uppercase & lt; & Lt; Result2.checksum () & lt; & Lt; Endl; Return 0; }   

This output is:

  Results 1: 2 dB698 Results 1: E29C91 Results 2: 2 dB6 9 According to the manual,  checksum () returns   

Returns the "CRC checksum of data passed so far". Therefore, the second checksum is a checksum for integrating data 1 by itself and thus is naturally different from the checksum of Data 1.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -