Do not use the hex strings returned by md5() as a key for MCrypt 256-bit encryption. Hex characters only represent four bits each, so when you take 32 hex characters, you are only really using a 128-bit key, not a 256-bit one.

Using an alphanumeric key generator [A-Za-z0-9] will also only provide a 192-bit key in 32 characters.

Two different MD5s concatenated in raw binary form, or mcrypt_create_iv(32,MCRYPT_DEV_RANDOM) will give you a true 256-bit key string.

MySQL MD() will not give you the same hash if character set is different.ex :<?php#suppose table_name CHARSET=UTF8#$md5 = md5('Städte'); # will give you a different hash than MySQL MD5()#instead use$md5 = md5(utf8_encode('Städte')); $r = mysql_query("SELECT *, MD5(`word`) FROM `table_name` WHERE MD5(`word`) LIKE '{$md5}'");if($r) while( $row= mysql_fetch_assoc($r) )print_r($row);