4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #include "support/checksum.h"
13 #include "boost/crc.hpp"
20 unsigned long checksum(std::string const & s)
22 boost::crc_32_type crc;
23 crc.process_bytes(s.c_str(), s.size());
24 return crc.checksum();
27 unsigned long checksum(std::ifstream & ifs)
29 std::istreambuf_iterator<char> beg(ifs);
30 std::istreambuf_iterator<char> end;
32 boost::crc_32_type crc;
33 crc = for_each(beg, end, crc);
34 return crc.checksum();
37 unsigned long checksum(char const * beg, char const * end)
39 boost::crc_32_type crc;
40 crc.process_block(beg, end);
41 return crc.checksum();
44 } // namespace support