Generate Argon2id Password Hash using Python

argon2-cffi library

  1. Install argon2-cffi library from the command line:
pip install argon2-cffi
  1. Generate Argon2id password hash:
from argon2 import PasswordHasher, Type

ph = PasswordHasher(
    memory_cost=65536,
    time_cost=4,
    parallelism=2,
    hash_len=32,
    type=Type.ID
)

password = 'Hello'
passwordHash = ph.hash(password)

print(passwordHash)

Leave a Comment

Cancel reply

Your email address will not be published.