Martin Vermeer wrote:
> A good signature has the following properties:
> 
> 1) it _never_ changes when the row does not change. (e.g., not when you
> add characters above it in the paragraph.)
> 2) it _always_ changes when the row changes. On this, the current
> signature is weak.
> 
> The best signature would be a checksum computed over the row content,
> but designed such that, e.g., changing the order of the characters will
> produce a different checksum. Such a checksum would be rather expensive
> to compute.
> 
> We should think of a signature that is simple and cheap, but better than
> this one.

Why not try a real checksum? See support/lyxsum.C for code that acts on a
file. Should be easy to adapt to one that acts on a std::string.

In fact...

unsigned long do_crc(std::string::const_iterator first,
                     std::string::const_iterator last)
{
        boost::crc_32_type crc;
        crc = std::for_each(first, last, crc);
        return crc.checksum();
}

-- 
Angus

Reply via email to