in reply to speeding up a hash lookup

A hash is a rather poor fit to this task. You should consider using a search tree of some sort.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print