METHOD FOR SELECTING HASH FUNCTION, METHOD FOR STORING AND SEARCHING ROUTING TABLE AND DEVICES THEREOF
First Claim
1. A method for selecting a hash function, comprising:
- inputting data to be hashed;
hashing the data to be hashed by using a current alternative hash function;
decoding a hash result; and
accumulating the decoded results, if a carry occurs, replacing the current alternative hash function with a next alternative hash function to hash the data to be hashed until no carry occurs during the accumulation; and
selecting a current alternative hash function as a formal hash function if no carry occurs.
1 Assignment
0 Petitions
Accused Products
Abstract
A method for selecting a hash function, a method for storing and searching a routing table and devices thereof are provided. The method for selecting a hash function includes: hashing data to be hashed by using a current alternative hash function; decoding a hash result; accumulating decoded results until no carry occurs during the accumulation; and selecting a current alternative hash function with no carry generated as a formal hash function. The method for storing a routing table includes: dividing the routing table into a next-level node pointer portion and a prefix portion for being stored; and selecting a hash function by using the above method for selecting a hash function. The method for searching a routing table includes: directly searching an IP address to be searched according to a directly stored length of a next-level node pointer portion for storing the routing table; and reading a prefix node according to a searched result. Thus, hash collision can be avoided, and memory resources occupied by the routing table can be effectively reduced.
-
Citations
15 Claims
-
1. A method for selecting a hash function, comprising:
-
inputting data to be hashed; hashing the data to be hashed by using a current alternative hash function; decoding a hash result; and accumulating the decoded results, if a carry occurs, replacing the current alternative hash function with a next alternative hash function to hash the data to be hashed until no carry occurs during the accumulation; and
selecting a current alternative hash function as a formal hash function if no carry occurs. - View Dependent Claims (2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15)
-
-
5. A device for selecting a hash function, comprising:
-
an alternative hash function unit, configured to send a current alternative hash function; at least one hash unit, configured to receive input data to be hashed and hash the data to be hashed by using the current alternative hash function sent by the alternative hash function unit; at least one decoder, configured decode a hash result of the hash unit; and an accumulator, configured to accumulate decoded results of the decoder, and instruct the alternative hash function unit to replace the current alternative hash function with a next alternative hash function if a carry occurs or instruct the alternative hash function unit to select the current alternative hash function with no carry generated as a formal hash function if no carry occurs. - View Dependent Claims (6, 7)
-
Specification