1. A method for encoding one or more key matching rules grouped in a chunk, the method comprising: in a rule encoding engine, communicatively coupled to memory and provided with a chunk of key matching rules, building a multi-rule corresponding to the chunk comprising: storing in the memory a multi-rule header of the multi-rule, the multi-rule header representing headers of the key matching rules.