A computer-implemented method for forwarding packets, comprising: receiving, by a computer, a packet with a hierarchically structured variable length identifier, "HSVLI", which comprises contiguous name components ordered from a most general level to a most specific level; performing a longest prefix match lookup for forwarding the packet by selecting an entry from a first data structure of entries and comparing name components of the entry with HSVLI name components of the packet to identify an entry with the largest number of common name components from the most general level to the most specific level, each entry indicating a name component, forwarding information for the name component, and a plurality of entry identifiers that chain the respective entry to another entry, by: in response to determining that a size of a name component is less than or equal to a predetermined threshold: creating an entry in the first data structure based on the name component; in response to determining that the size is greater than the predetermined threshold: performing a first compression function on the name component to obtain a compressed key; and creating an entry in the first data structure based on the compressed key; and in response to determining an insertion collision based on the created entry, resolving the insertion collision by: including a collision indicator in the created entry in the first data structure; performing a second compression function on the name component to obtain a new lookup key; and creating an entry in a third data structure based on the new lookup key, wherein the third data structure indicates the new lookup key and forwarding information for the name component; in response to determining a lookup collision associated with the selected entry, resolving the lookup collision by: determining that the selected entry includes the collision indicator; performing the second compression function on the name component to obtain the new lookup key; and selecting an entry in the third data structure based on the new lookup key, thereby facilitating forwarding of packets with variable length names. receiving, by a computer, a packet with a hierarchically structured variable length identifier, "HSVLI", which comprises contiguous name components ordered from a most general level to a most specific level; performing a longest prefix match lookup for forwarding the packet by selecting an entry from a first data structure of entries and comparing name components of the entry with HSVLI name components of the packet to identify an entry with the largest number of common name components from the most general level to the most specific level, each entry indicating a name component, forwarding information for the name component, and a plurality of entry identifiers that chain the respective entry to another entry, by: in response to determining that a size of a name component is less than or equal to a predetermined threshold: creating an entry in the first data structure based on the name component; in response to determining that the size is greater than the predetermined threshold: performing a first compression function on the name component to obtain a compressed key; and creating an entry in the first data structure based on the compressed key; and in response to determining that a size of a name component is less than or equal to a predetermined threshold: creating an entry in the first data structure based on the name component; creating an entry in the first data structure based on the name component; in response to determining that the size is greater than the predetermined threshold: performing a first compression function on the name component to obtain a compressed key; and creating an entry in the first data structure based on the compressed key; and performing a first compression function on the name component to obtain a compressed key; and creating an entry in the first data structure based on the compressed key; and in response to determining an insertion collision based on the created entry, resolving the insertion collision by: including a collision indicator in the created entry in the first data structure; performing a second compression function on the name component to obtain a new lookup key; and creating an entry in a third data structure based on the new lookup key, wherein the third data structure indicates the new lookup key and forwarding information for the name component; including a collision indicator in the created entry in the first data structure; performing a second compression function on the name component to obtain a new lookup key; and creating an entry in a third data structure based on the new lookup key, wherein the third data structure indicates the new lookup key and forwarding information for the name component; in response to determining a lookup collision associated with the selected entry, resolving the lookup collision by: determining that the selected entry includes the collision indicator; performing the second compression function on the name component to obtain the new lookup key; and selecting an entry in the third data structure based on the new lookup key, thereby facilitating forwarding of packets with variable length names. determining that the selected entry includes the collision indicator; performing the second compression function on the name component to obtain the new lookup key; and selecting an entry in the third data structure based on the new lookup key, thereby facilitating forwarding of packets with variable length names.