I\'m essentially preparing phrases to be put into the database, they may be malformed so I want to store a short hash of them instead (I will be simply comparing if they exi
Caveat
The answer below does not answer the question as asked, since it does not recommend hash functions. Remember, "A hash function is any function that can be used to map data of arbitrary size to fixed-size values." (Wikipedia) The answer below recommends transformations that do not guarantee fixed-size results.
If you are willing to relax the requirement of using a hash function, read on...
Original Answer
I suggest urlencode() or base64_encode() for these reasons:
Adapting the benchmark code elsewhere in these replies, I've demonstrated that either of these are way faster than any hash algorithm. Depending on your application, you might be able to use urlencode() or base64_encode() to clean up any 'malformed' strings you want to store.