摘要
在实际应用中经常需要查找某IP地址其在数据库中对应的真实的物理地址,而数据库的数据量往往很大,显然直接去查询数据库不能满足大量数据以及高速查找的要求。在最长前缀匹配算法的基础上,提出了一种基于哈希查找表的IP地址查找算法。将数据库中的信息建立为一个哈希表,并将点分十进制IP地址的部分前缀作为键值,映射到哈希表中的一条记录,从而得到所需的信息。最后用C#语言实现了该算法,实验表明该算法具有很高的效率。
In practical applications, it's often need to translate the IP address into physical address according to the database that stores the detail information about the IP address. However the database is often too large, so that it's low efficient to search massive data directly in the database. On the basis of the longest-prefix matching algorithm, a hash table based IP address search algorithm is proposed. The information in the database is established as a hash table, and takes the prefix of an IP address in decimal format as a key to map to the corresponding item in the hash table, and then it can be obtain the necessary information. Finally, the algorithm is realized with C# language, and it's proved to be efficient according to the experiments.
出处
《微计算机信息》
2009年第30期143-144,142,共3页
Control & Automation
关键词
IP
最长前缀匹配
哈希表
IP
longest prefix matching
hash table