Is there some reason you don't want to use an existing algorithm like CRC or MD5?
In order to reduce the collision rate, it will help if you spread out the signature values over a larger output set. To keep from overflowing, you can choose a big modulus $M.
$x = ($x + $P[$_] * $str[$_]) % $M for 0 .. $#strIt's common to choose $M to be a power of two, so "% $M" becomes "& ($M - 1)". Choosing $M prime has some mathematical advantages, but as long as none of the @P values has any common factors with $M it works ok. If you set $P[$_] to $K**$_ for some $K, you won't even have to store @P.
In reply to Re: An optimal solution to finding weights for a weighted sum signature.
by Anonymous Monk
in thread An optimal solution to finding weights for a weighted sum signature.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |