TypeError: no salt specified

18 views
Skip to first unread message

berisla...@gmail.com

unread,
Apr 28, 2020, 4:31:49 PM4/28/20
to passlib-users
Hi, I have just trying out the library, but have ran into a strange problem straight away. I'm just following the steps from the basic tutorial:

>>> from passlib.hash import pbkdf2_sha256
>>> pbkdf2_sha256("aaa")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/berislav/.virtualenvs/toptal/lib/python3.8/site-packages/passlib/utils/handlers.py", line 1795, in __init__
    super(HasRounds, self).__init__(**kwds)
  File "/home/berislav/.virtualenvs/toptal/lib/python3.8/site-packages/passlib/utils/handlers.py", line 1417, in __init__
    raise TypeError("no salt specified")
TypeError: no salt specified

I've tried it in Python versions 3.6, 3.7 and 3.8, in pristine new virtualenvs... Any ideas what am I doing wrong here?

Thank you!

Best,

Berislav

rol...@micite.net

unread,
Apr 29, 2020, 4:33:26 AM4/29/20
to berisla...@gmail.com, passlib-users


On 28 April 2020 22:31:49 CEST, berisla...@gmail.com wrote:
>Hi, I have just trying out the library,

Cool :)

> but have ran into a strange
>problem
>straight away. I'm just following the steps from the basic tutorial:

This tutorial: https://passlib.readthedocs.io/en/stable/ ?
>
>>>> from passlib.hash import pbkdf2_sha256
>>>> pbkdf2_sha256("aaa")

Please read this line in the tutorial again. You're missing something essential.
Try to copy paste it from the tutorial first.

>Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
>"/home/berislav/.virtualenvs/toptal/lib/python3.8/site-packages/passlib/utils/handlers.py",
>
>line 1795, in __init__
> super(HasRounds, self).__init__(**kwds)
> File
>"/home/berislav/.virtualenvs/toptal/lib/python3.8/site-packages/passlib/utils/handlers.py",
>
>line 1417, in __init__
> raise TypeError("no salt specified")
>TypeError: no salt specified
>
>I've tried it in Python versions 3.6, 3.7 and 3.8, in pristine new
>virtualenvs... Any ideas what am I doing wrong here?

I like it that you've tried multiple things to narrow the problem down. Unfortunately it has nothing to do with the python version.
>
>Thank you!
>
>Best,
>
>Berislav

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Eli Collins

unread,
May 2, 2020, 10:01:29 AM5/2/20
to passlib-users
Hi!

You actually want to be using the ".hash()" method of the class, not calling the constructor itself (the tutorial should probably emphasize that).

Try 
   >>> pbkdf2_sha256.hash("aaa")
Instead of
   >>> pbkdf2_sha256("aaa")

- Eli
Reply all
Reply to author
Forward
0 new messages