def to_string(self): if self.rounds == 5000 and self.implicit_rounds: hash = u('%s%s$%s') % (self.ident, self.salt, self.checksum or u('')) else: hash = u('%srounds=%d$%s$%s') % (self.ident, self.rounds, self.salt, self.checksum or u('')) return uascii_to_str(hash)
def _wrap_hash(self, hash): if isinstance(hash, bytes): hash = hash.decode('ascii') orig_prefix = self.orig_prefix if not hash.startswith(orig_prefix): raise exc.InvalidHashError(self.wrapped) wrapped = self.prefix + hash[len(orig_prefix):] return uascii_to_str(wrapped)
def to_string(self, _withchk=True): ss = u('') if self.bare_salt else u('$') rounds = self.rounds if rounds > 0: hash = u('$md5,rounds=%d$%s%s') % (rounds, self.salt, ss) else: hash = u('$md5$%s%s') % (self.salt, ss) if _withchk: chk = self.checksum hash = u('%s$%s') % (hash, chk) return uascii_to_str(hash)
def render_mc3(ident, rounds, salt, checksum, sep=u('$'), rounds_base=10): if rounds is None: rounds = u('') else: if rounds_base == 16: rounds = u('%x') % rounds else: rounds = unicode(rounds) if checksum: parts = [ident, rounds, sep, salt, sep, checksum] else: parts = [ident, rounds, sep, salt] return uascii_to_str(join_unicode(parts))
def to_string(self): hash = u('@salt%s%s') % (self.salt, self.checksum) return uascii_to_str(hash)
def to_string(self): hash = u('_%s%s%s') % (h64.encode_int24( self.rounds).decode('ascii'), self.salt, self.checksum) return uascii_to_str(hash)
def to_string(self): hash = u('%s%s%s%s') % (self.ident, h64.encode_int6( self.rounds).decode('ascii'), self.salt, self.checksum or u('')) return uascii_to_str(hash)
def to_string(self): chk = self.checksum hash = u('S:%s%s') % (chk.upper(), self.salt.upper()) return uascii_to_str(hash)
def to_string(self): data = self.checksum + self.salt hash = self.ident + b64encode(data).decode('ascii') return uascii_to_str(hash)
def to_string(self): return '%02d%s' % (self.salt, uascii_to_str(self.checksum))
def to_string(self): return uascii_to_str(self._hash_prefix + self.checksum)
def render_mc2(ident, salt, checksum, sep=u('$')): if checksum: parts = [ident, salt, sep, checksum] else: parts = [ident, salt] return uascii_to_str(join_unicode(parts))
def to_string(self): bhash = super(django_bcrypt_sha256, self).to_string() return uascii_to_str(self.django_prefix) + bhash
def _get_config(self, ident): config = u('%s%02d$%s') % (ident, self.rounds, self.salt) return uascii_to_str(config)
def to_string(self): hash = u('%s%02d$%s%s') % (self.ident, self.rounds, self.salt, self.checksum) return uascii_to_str(hash)
def to_string(self): hash = self._template % (self.ident.strip(_UDOLLAR), self.rounds, self.salt, self.checksum) return uascii_to_str(hash)