Cannot import name 'hasher' from 'streamlit_authenticator'

Not able to import Hasher. I am using python3.9.16 and streamlit version is 0.3.2

Getting this error
hashed_passwords = stauth.hasher([‘fashion@123’, ‘fashion’]).generate()
AttributeError: module ‘streamlit_authenticator’ has no attribute ‘hasher’

1 Like

Hi @Saurabh_Mittal,

Thanks for sharing this question!

I think they changed the directory for hasher recently based on their GitHub.

Here’s how you can use it now:

from streamlit_authenticator.utilities.hasher import Hasher

# Pass the list of passwords directly to the 
# Hasher constructor and generate the hashes
passwords_to_hash = ['fashion@123', 'increff@fashion']
hashed_passwords = Hasher(passwords_to_hash).generate()

print(hashed_passwords)
4 Likes

Thanks for the solution Tony!

Glad it worked for you! Happy Streamlit-ing! :balloon:

Thanks Tony. It worked

Awesome, glad it was helpful. Happy Streamlit-ing!:balloon:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.