Fix user creation for utf-8 usernames

The sha1 generated by the generate_sha1 function choked on utf8 strings.