passlib ValueError("hash could not be identified")

See original GitHub issue

I’m using passwords generated by ppc-gen-password something like $6$rounds=662480$eD9ewKeo67GHU8KF$bwPiwMy90zjvC5AuN27lBLP5Q3uKZOxX.wswfuVOMG0rntdLqM082XbtKh6UnG.bexmqmftJiGnoZGYy2opEf/ which is a hash for changeme

And I’m getting this error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pyramid/router.py", line 223, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/usr/local/lib/python2.7/site-packages/pyramid/router.py", line 198, in invoke_subrequest
    response = handle_request(request)
  File "/usr/local/lib/python2.7/site-packages/pyramid/tweens.py", line 20, in excview_tween
    response = handler(request)
  File "/usr/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 101, in tm_tween
    reraise(*exc_info)
  File "/usr/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 83, in tm_tween
    response = handler(request)
  File "/usr/local/lib/python2.7/site-packages/pyramid/router.py", line 145, in handle_request
    view_name
  File "/usr/local/lib/python2.7/site-packages/pyramid/view.py", line 541, in _call_view
    response = view_callable(context, request)
  File "/usr/local/lib/python2.7/site-packages/pyramid/config/views.py", line 602, in __call__
    return view(context, request)
  File "/usr/local/lib/python2.7/site-packages/pyramid/config/views.py", line 328, in attr_view
    return view(context, request)
  File "/usr/local/lib/python2.7/site-packages/pyramid/config/views.py", line 304, in predicate_wrapper
    return view(context, request)
  File "/usr/local/lib/python2.7/site-packages/pyramid/config/views.py", line 353, in rendered_view
    result = view(context, request)
  File "/usr/local/lib/python2.7/site-packages/pyramid_duh/params.py", line 306, in param_twiddler
    return fxn(**scope)
  File "/usr/local/lib/python2.7/site-packages/pypicloud/views/login.py", line 33, in do_login
    if request.access.verify_user(username, password):
  File "/usr/local/lib/python2.7/site-packages/pypicloud/access/base.py", line 230, in verify_user
    return bool(stored_pw and pwd_context.verify(password, stored_pw))
  File "/usr/local/lib/python2.7/site-packages/passlib/context.py", line 2553, in verify
    record = self._get_or_identify_record(hash, scheme, category)
  File "/usr/local/lib/python2.7/site-packages/passlib/context.py", line 2260, in _get_or_identify_record
    return self._identify_record(hash, category)
  File "/usr/local/lib/python2.7/site-packages/passlib/context.py", line 1457, in identify_record
    raise ValueError("hash could not be identified")

Any additional configuration I need to specify in my .ini file?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zen4evercommented, Apr 1, 2016

sorry, never mind, I’ve just discovered that because I run the prod.ini through envsubst to replace environment variables, it replaces “$rounds” with empty string, and it really confuses passlib. Thanks for the quick response

0reactions
stownscommented, Jan 19, 2022

sorry, never mind, I’ve just discovered that because I run the prod.ini through envsubst to replace environment variables, it replaces “$rounds” with empty string, and it really confuses passlib. Thanks for the quick response

wow…i literally just had the exact same issue and this saved me who knows how much time. thank you @zen4ever

Read more comments on GitHub >

github_iconTop Results From Across the Web

python flask-security: encryption error "hash could not be ...
If this is the case this means the password stored in the DB is in the wrong format. It is probably still plain...
Read more >
passlib.exc - Exceptions and warnings
Error raised if a password can't be hashed / verified for various reasons. This exception derives from the builtin ValueError . May be...
Read more >
inveniosoftware/invenio - Gitter
/passlib/context.py", line 1457, in identify_record raise ValueError("hash could not be identified") ValueError: hash could not be identified. Jiri Kuncar.
Read more >
Passlib Documentation - Read the Docs
ValueError: not a valid pbkdf2_sha256 hash. This can be prevented by using the identify method, which determines whether a hash belongs to a ......
Read more >
OAuth2 with Password (and hashing), Bearer with JWT tokens
After a week, the token will be expired and the user will not be authorized and will have ... PassLib is a great...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found