There is application like yours in networking - looking for IP addresses in the router tables. Special ICs (NSE - Network Search Engines) are used for this purposes. They are just a content-addressable memory (CAM) with some additional hardware for record aging, masks support etc. Check Cypress, Mosaid, AMCC, ISSI sites for details (keyword: NSE). With CAM you can achive the highest possible searching speed, because they can search for match in all memory locations at once.
Ace-X.