使用py-bcrypt,您不需要单独存储盐:
bcrypt将盐存储在哈希中。
您可以简单地将哈希用作盐,盐将存储在哈希的开头。
>>> import bcrypt>>> salt = bcrypt.gensalt()>>> hashed = bcrypt.hashpw('secret', salt)>>> hashed.find(salt)0>>> hashed == bcrypt.hashpw('secret', hashed)True>>>
使用py-bcrypt,您不需要单独存储盐:
bcrypt将盐存储在哈希中。
您可以简单地将哈希用作盐,盐将存储在哈希的开头。
>>> import bcrypt>>> salt = bcrypt.gensalt()>>> hashed = bcrypt.hashpw('secret', salt)>>> hashed.find(salt)0>>> hashed == bcrypt.hashpw('secret', hashed)True>>>