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.28s 10524KB
stdin
Standard input is empty
stdout
b'$2b$12$N7P3.wLeOQ6H1uzKhPSXkee.b7QZ/YcPIBTCIU0fYaJweUzI2gefO'