A data retrieving apparatus which processes an input packet, included in a set of received input packets, each, of said received input packets having a plurality of identification data of an arbitrary bit length, with the identification data in each said input packet including at least two bit strings which have differing values in each of said received input packets, comprising:
- address generating means for selecting partly the two bit strings from said identification data of said input packet, and generating a storing address of said input packet by a reversible operation of the selected bit strings;
- a hash memory means for holding parts or all of a plurality of data packets, such hash memory means having addresses corresponding to the storing addresses generated by the address generating means;
- first storing means for storing a part or all of said input packet in the hash memory at said storing address;
- comparing means for comparing a part or all of the identification data of a stored packet previously stored at the storing address with a part or all of the identification data of the input packet, and for determining the equivalence of said compared data, when a valid packet is already stored in said storing address reserved for the input packet;
- second storing means for storing a part or all of said input packet regarding the identification data of the input packet as a retrieval data, when said comparing means judges said two identification data to be mismatched;
- judging means for judging a match of the identification data of the input packet with the identification data of packets already stored in said second storing means, when a packet is input;
- and
- selecting means for selecting an output from said first storing means or said second storing means in response to the result of the judgment of said judging means.