Remove the utf8_encode function.
Replace stlen and substr with their mb equivalents.
Remove the step attribute for the number of passwords and hashes to generate.