fork download
  1. import bcrypt
  2.  
  3. # example password
  4. password = '1toto;2'
  5.  
  6. # converting password to array of bytes
  7. bytes = password.encode('utf-8')
  8.  
  9. # generating the salt
  10. salt = bcrypt.gensalt()
  11.  
  12. # Hashing the password
  13. hash = bcrypt.hashpw(bytes, salt)
  14.  
  15. print(hash)
Success #stdin #stdout 0.36s 10576KB
stdin
Standard input is empty
stdout
b'$2b$12$iSrDuRyJUorstlX2ig7gbezLWp29sVh60N5KafVcYDVWiahN727qu'