Skip to content

Instantly share code, notes, and snippets.

@redspider
Created January 3, 2011 05:00
Show Gist options
  • Save redspider/763138 to your computer and use it in GitHub Desktop.
Save redspider/763138 to your computer and use it in GitHub Desktop.
>>> import bcrypt
>>> password = "kitten"
>>> salt = bcrypt.gensalt()
>>> salt
'$2a$12$yqUmgo2jguH0dsoH5m6JWe'
>>> hashed = bcrypt.hashpw(password, salt)
>>> hashed
'$2a$12$yqUmgo2jguH0dsoH5m6JWeFYBfSqGjVQ26llCDhg/tYmpC14EUJyS'
>>> hashed[:29] == salt
True
>>> bcrypt.hashpw(password, hashed) == hashed
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment