34 Meta m(
"hash_roll",
"rk",
"Karp-Rabin Rolling Hash");
47 for (
int i=0; i <
n ; ++i) {
54 template<
class container>
55 hashvaluetype
hash(container & c) {
56 hashvaluetype answer(0);
57 for(
uint k = 0; k<c.size(); ++k) {
59 for(
uint j = 0; j< c.size()-1-k; ++j) {
70 void eat(chartype inchar) {
76 void update(chartype outchar, chartype inchar) {
84 CharacterHash<hashvaluetype,chartype>
hasher;
87 static const hashvaluetype
B=37;
static const hashvaluetype B
Contains the text compression and encoding framework.
void eat(chartype inchar)
CharacterHash< hashvaluetype, chartype > hasher
void update(chartype outchar, chartype inchar)
hashvaluetype operator()() const
This is a randomized version of the Karp-Rabin hash function.
Env & env()
Provides access to the environment that the algorithm works in.
const hashvaluetype HASHMASK
hashvaluetype hash(container &c)
Local environment for a compression/encoding/decompression call.
Interface for algorithms.