Dark Prince Posted January 24, 2012 Share Posted January 24, 2012 there are so many generators for hash codes whats the best one to generate low character hashes around 6 to 12 characters? Link to comment Share on other sites More sharing options...
Antonio Conte Posted January 27, 2012 Share Posted January 27, 2012 What are you going to use the hash codes for? Passwords? Searching for objects? You kind of have to specify the context you want to use them in. Link to comment Share on other sites More sharing options...
Antonio Conte Posted February 2, 2012 Share Posted February 2, 2012 If you come from anorher language, like java, associative arrays works exactly as hash tables. Always an O(1) operation! 1 Link to comment Share on other sites More sharing options...
Dark Prince Posted February 12, 2012 Author Share Posted February 12, 2012 I just want to create a short 8 to 12 character hash code that I can use to identify certain rows in a table instead of using an id number, and also to be used in a security check. Link to comment Share on other sites More sharing options...
Larry Posted February 13, 2012 Share Posted February 13, 2012 Just so you're aware, an id number will be more efficient, as databases deal with numbers faster than strings and primary keys are often used as the basis of queries. Link to comment Share on other sites More sharing options...
Dark Prince Posted February 15, 2012 Author Share Posted February 15, 2012 I'm not sure I want to use it for identify rows in a table yet but it would be nice to be able to add a 8 character hash to some fields like file uploads having a hash before the file name will reduce the likeliness of a file being overwritten by 99.999%, does cr32 create an 8 character hash or does it need to be truncated? Link to comment Share on other sites More sharing options...
Larry Posted February 15, 2012 Share Posted February 15, 2012 Or you could store the file name using the primary key for the related table, which would 100% guarantee no overwrites. As for "cr32", there's no such thing. If you're asking about crc32(), check out the PHP manual to see what it returns, or try it in code yourself. Link to comment Share on other sites More sharing options...
Dark Prince Posted February 16, 2012 Author Share Posted February 16, 2012 well in some of my tables there is more then 1 file upload per row, but yeah it was crc32 and yeah you are right I should just check it myself to see what I get. Link to comment Share on other sites More sharing options...
Recommended Posts