Generate shorter public id
问题 I am looking for a way to generate public ids for my objects (like a facebook uid). The id should be unique and the user should not be able to guess it (or the next one). Right now I am using this: sha1('a fixed random string' . $this->getId()) The problem is that sha1 generates very long strings (40 chars) and I would like it to be shorter. I thought about using MD5 but it's known to be not save because you can create collisions. Is this really a problem in my case? What alternatives do I