Using php mhash functions to create a key from a string

Solution:1

It doesn’t matter how many characters you pass for $mystringmhash will return 32 characters every time.

A simple test on the command line will illustrate

php > var_dump(mhash(MHASH_SHA256, 'blah'));
string(32) "?}?C?qnϥ?0/kB???R??e?`0?R"
php > var_dump(mhash(MHASH_SHA256, 'blahadfadf'));
string(32) "t?+jm~8??f?vD???'?R????a:??巯"
php > var_dump(mhash(MHASH_SHA256, 'blasdfafadf'));
string(32) "<?Z,?????,m???\5k??i???B???"
php > var_dump(mhash(MHASH_SHA256, 'blasasdfasdfasdfasf'));
string(32) "?]?,5Þظ?&x??T{?8?]?5??  Y?"
php > var_dump(mhash(MHASH_SHA256, 'blasasdfasdfasdfasfadfjads;fkjas;ldkfjas;dkjfa;sdjkf'));
string(32) "j?̳ebb??Z'??????9??^s???F"