def _norm_checksum(self, checksum, relaxed=False):
checksum = super(_BcryptCommon, self)._norm_checksum(checksum, relaxed=relaxed)
changed, checksum = bcrypt64.check_repair_unused(checksum)
if changed:
warn(
"encountered a bcrypt hash with incorrectly set padding bits; "
"you may want to use bcrypt.normhash() "
"to fix this; this will be an error under Passlib 2.0",
PasslibHashWarning)
return checksum
#===================================================================
# backend configuration
# NOTE: backends are defined in terms of mixin classes,
# which are dynamically inserted into the bases of the 'bcrypt' class
# via the machinery in 'SubclassBackendMixin'.
# this lets us load in a backend-specific implementation
# of _calc_checksum() and similar methods.
#===================================================================
# NOTE: backend config is located down in <bcrypt> class
# NOTE: set_backend() will execute the ._load_backend_mixin()
# of the matching mixin class, which will handle backend detection
# appended to HasManyBackends' "no backends available" error message
评论列表
文章目录