コード例 #1
0
ファイル: encrypt.py プロジェクト: goldenchild731/ansible-1
    def _clean_salt(self, salt):
        if not salt:
            return None
        elif issubclass(self.crypt_algo, HasRawSalt):
            ret = to_bytes(salt, encoding='ascii', errors='strict')
        else:
            ret = to_text(salt, encoding='ascii', errors='strict')

        # Ensure the salt has the correct padding
        if self.algorithm == 'bcrypt':
            ret = bcrypt64.repair_unused(ret)

        return ret
コード例 #2
0
ファイル: bcrypt.py プロジェクト: docovarr2020/DIYnow
 def _generate_salt(cls):
     # generate random salt as normal,
     # but repair last char so the padding bits always decode to zero.
     salt = super(_BcryptCommon, cls)._generate_salt()
     return bcrypt64.repair_unused(salt)
コード例 #3
0
ファイル: bcrypt.py プロジェクト: dragoncsc/HDsite
 def _generate_salt(cls):
     # generate random salt as normal,
     # but repair last char so the padding bits always decode to zero.
     salt = super(_BcryptCommon, cls)._generate_salt()
     return bcrypt64.repair_unused(salt)