mcrypt_create_iv() default is MCRYPT_DEV_RANDOM. generateRandomBytes() should use urandom.