Rolling Hash - Content Based Slicing Using Rabin-Karp Hash

Content Based Slicing Using Rabin-Karp Hash

One of the interesting use cases of the rolling hash function is that it can create dynamic, content-based chunks of a stream or file. This is especially useful when it is required to send only the changed chunks of a large file over a network and a simple byte addition at the front of the file would cause all the fixed size windows to become updated, while in reality, only the first ‘chunk’ has been modified.

The simplest approach to calculate the dynamic chunks is to calculate the rolling hash and if it matches a pattern (like the lower N bits are all zeroes) then it’s a chunk boundary. This approach will ensure that any change in the file will only affect it’s current and possibly the next chunk, but nothing else.

When the boundaries are known, the chunks need to be compared by their hash values to detect which one was modified and needs transfer across the network.

Read more about this topic:  Rolling Hash

Famous quotes containing the words content and/or based:

    In America the taint of sectarianism lies broad upon the land. Not content with acknowledging the supremacy as the Diety, and with erecting temples in his honor, where all can bow down with reverence, the pride and vanity of human reason enter into and pollute our worship, and the houses that should be of God and for God, alone, where he is to be honored with submissive faith, are too often merely schools of metaphysical and useless distinctions. The nation is sectarian, rather than Christian.
    James Fenimore Cooper (1789–1851)

    The common erotic project of destroying women makes it possible for men to unite into a brotherhood; this project is the only firm and trustworthy groundwork for cooperation among males and all male bonding is based on it.
    Andrea Dworkin (b. 1946)