Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • passlib passlib
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 38
    • Issues 38
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • python-libs
  • passlibpasslib
  • Issues
  • #49

Closed
Open
Created Jun 12, 2013 by Bitbucket Importer@bitbucket_importerOwner

Incompatibility with bcrypt backend

Created originally on Bitbucket by Anonymous

(Imported from Google Code)

leckey.ryan wrote:

What steps will reproduce the problem?
1. pip install passlib
2. pip install bcrypt
3. passlib.hash.bcrypt.encrypt('password')

What is the expected output? What do you see instead?

The expected output is the hashed password. Instead the
traceback below occurs.

What version of the product are you using? On what operating system?

I've tried this both with the latest release (1.6.1) and with the default branch from source control.

Please provide any additional information below.

Below is the traceback.

.../python3.3/site-packages/passlib/utils/handlers.py in encrypt(cls, secret, **kwds)

551 validate_secret(secret)
552 self = cls(use_defaults=True, **kwds)
--> 553 self.checksum = self._calc_checksum(secret)
554 return self.to_string()
555

.../python3.3/site-packages/passlib/handlers/bcrypt.py in _calc_checksum_pybcrypt_threadsafe(self, secret)

277 # used through passlib, this should be safe.
278 with self._calc_lock:
--> 279 return self._calc_checksum_pybcrypt(secret)
280
281 def _calc_checksum_pybcrypt(self, secret):

.../python3.3/site-packages/passlib/handlers/bcrypt.py in _calc_checksum_pybcrypt(self, secret)

289 raise uh.exc.NullPasswordError(self)
290 config = self._get_config()
--> 291 hash = _pybcrypt_hashpw(secret, config)
292 assert hash.startswith(config) and len(hash) == len(config)+31
293 return str_to_uascii(hash[-31:])

.../python3.3/site-packages/bcrypt/__init__.py in hashpw(password, salt)

89 def hashpw(password, salt):
90 if isinstance(password, text_type) or isinstance(salt, text_type):
---> 91 raise TypeError("Unicode-objects must be encoded before hashing")
92
93 hashed = _ffi.new("unsigned char[]", 128)

TypeError: Unicode-objects must be encoded before hashing

If you need anything else; let me know.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking