Shorter php cipher than md5?

Asked
Active3 hr before
Viewed126 times

3 Answers

shorter
90%

maybe this will help you generate a 12 char string that you can pass in a URL, without increasing the risk of collisions,You may also generate any random string and insert it into database, checking if not already exists prior to saving. This will allow you to have short hashes, and ensure there are no collisions.,I also have to assume that you can create many form fields but they can't have a length larger than 12 characters each.,For a variety of stupid reasons, the maximum length of a given form variable that we are posting to an external server is 12 characters.

maybe this will help you generate a 12 char string that you can pass in a URL, without increasing the risk of collisions

substr(base_convert(md5($string), 16, 32), 0, 12);
load more v
88%

I wanted to obscure that value with md5, but obviously with 12 characters that isn't going to work. Is there a cipher with an already-made PHP function which will result in something 12 characters or less?,I also have to assume that you can create many form fields but they can't have a length larger than 12 characters each.,maybe this will help you generate a 12 char string that you can pass in a URL, without increasing the risk of collisions,If you just need a hash, you can still use the first 12 characters from the md5 hash.

You can reduce the loss of information by taking the first twelve characters of a 16 character representation (the raw form):

substr(md5($string, true), 0, 12);
load more v
72%

Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..). For a list of supported algorithms see hash_algos(). ,md5() - Calculate the md5 hash of a string,sha1() - Calculate the sha1 hash of a string, hash_​hmac_​algos

ec457d0a974c48d5685a7efa03d137dc8bbde7e3