title: "TypeError: hashpw() argument 1 must be str, not bytes" when trying to register a user with flask-security
body: <p>I'm trying to create a small flask application using the <a href="http://enferno.io/" rel="nofollow">Enferno framework</a>, but when I try to register a user I get an error that seems to be generated by the passlib library. I can't understand if it's something I did or if it is an error in the library itself.</p>
  
  <p>Here's the full traceback:</p>
  
  <pre><code>Traceback (most recent call last):
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1836, in __call__
          return self.wsgi_app(environ, start_response)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1820, in wsgi_app
          response = self.make_response(self.handle_exception(e))
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1403, in handle_exception
          reraise(exc_type, exc_value, tb)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
          raise value
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
          response = self.full_dispatch_request()
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
          rv = self.handle_user_exception(e)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
          reraise(exc_type, exc_value, tb)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
          raise value
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
          rv = self.dispatch_request()
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
          return view_func(**req.view_args)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/decorators.py", line 205, in wrapper
          return f(*args, **kwargs)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/views.py", line 117, in register
          user = register_user(**form.to_dict())
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/registerable.py", line 28, in register_user
          kwargs['password'] = encrypt_password(kwargs['password'])
      File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/utils.py", line 151, in encrypt_password
          return _pwd_context.encrypt(signed)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/context.py", line 2495, in encrypt
          return self._get_record(scheme, category).encrypt(secret, **kwds)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/utils/handlers.py", line 558, in encrypt
          self.checksum = self._calc_checksum(secret)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/handlers/bcrypt.py", line 285, in _calc_checksum
          return self._calc_checksum_backend(secret)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/utils/handlers.py", line 1458, in _calc_checksum_backend
          return self._calc_checksum_backend(secret)
      File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/handlers/bcrypt.py", line 333, in _calc_checksum_pybcrypt
          hash = _bcrypt.hashpw(secret, config)
  TypeError: hashpw() argument 1 must be str, not bytes
  </code></pre>