1. A method for processing packets in a network device, the method comprising: parsing a packet by a programmable processing unit executing computer readable instructions stored in a non-transitory computer readable storage medium, including identifying, by executing instructions stored in the non-transitory computer readable storage memory, one or more protocol layers within a header of the packet, identifying, by executing instructions stored in the non-transitory computer readable storage memory, respective locations of protocol headers within the header of the packet, the respective locations corresponding to respective one or more identified protocol layers, and providing the respective identified locations of protocol headers within the header of the packet to a hardware key generator block configured to generate one or more keys for the packet based at least on information included in the packet; generating, by the key generator block and using the respective identified locations, a lookup key corresponding to the packet, including extracting, using an identified location of a protocol header, one or more fields from the corresponding protocol header, and generating the lookup key to include the one or more fields; providing the lookup key to a lookup engine; and performing, by the lookup engine and based on the lookup key, a lookup operation with respect to the packet.