1. A non-transitory machine readable medium storing a program that, when executed by at least one processing unit, generates a hash to process a packet, the program comprising sets of instructions for: dividing at least a portion of a packet's header into a plurality of chunks, including a set of chunks that are of equal size; hashing the set of chunks to generate a set of hashes; for each remaining chunk, hashing each remaining chunk into one of the generated hashes in the set of hashes; merging the set of hashes with one another to produce a final hash for the portion of the header; and processing the packet based on the final hash.