An apparatus is disclosed for generating keys having one of a number of
key sizes. Memory sections of a memory element are adapted to store a
portion of a key. The memory element has a size at least as large as a
largest key size of a number of key sizes, the key having a size of one
of the plurality of key sizes. Key generation logic is adapted to
generate intermediate key results for the key by operating on values from
the memory sections and from the intermediate key results. Key selection
logic is adapted to route selected intermediate key results to selected
ones of the memory sections. The control logic is adapted to determine
the size of the key and, based at least partially on the size of the key,
to select the selected intermediate key results and the selected ones of
the memory sections. The selected intermediate key results comprise some
or all of the key.