我想使用boost :: crc,使其功能与PHP's crc32()函数完全相同。我尝试阅读horrible documentation,后来我还没有取得任何进展。如何使用boost :: crc?
显然,我需要做的是这样的:
int GetCrc32(const string& my_string) {
return crc_32 = boost::crc<bits, TruncPoly, InitRem, FinalXor,
ReflectIn, ReflectRem>(my_string.c_str(), my_string.length());
}
bits
应该是32。什么其他的事情都是一个谜。一点帮助? ;)
您也可以使用此http://svn.abisource.com/ wv/branches/release-version-0-7-12/crc32.c和http://svn.abisource.com/wv/branches/release-version-0-7-1 2/crc32.h。我假设算法是相同的,但速度比boost crc更好。 – schoetbi 2011-04-21 12:08:31