fixed Unicode-objects must be encoded before hashing in
generate_sha1 function.