コード例 #1
0
ファイル: pbkdf2.py プロジェクト: Aravs7/ubtz2
 def from_string(cls, hash):
     # NOTE: passlib deviation - forbidding zero-padded rounds
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, rounds_base=16, handler=cls)
     salt = b64decode(salt.encode("ascii"), CTA_ALTCHARS)
     if chk:
         chk = b64decode(chk.encode("ascii"), CTA_ALTCHARS)
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #2
0
ファイル: pbkdf2.py プロジェクト: MadAd360/GoGramming
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash,
                                      cls.ident,
                                      rounds_base=16,
                                      default_rounds=400,
                                      handler=cls)
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #3
0
 def from_string(cls, hash):
     # NOTE: passlib deviation - forbidding zero-padded rounds
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, rounds_base=16, handler=cls)
     salt = b64decode(salt.encode("ascii"), CTA_ALTCHARS)
     if chk:
         chk = b64decode(chk.encode("ascii"), CTA_ALTCHARS)
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #4
0
ファイル: pbkdf2.py プロジェクト: Aravs7/ubtz2
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, sep=u("."),
                                      handler=cls)
     salt = unhexlify(salt.encode("ascii"))
     if chk:
         chk = unhexlify(chk.encode("ascii"))
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #5
0
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, sep=u("."),
                                      handler=cls)
     salt = unhexlify(salt.encode("ascii"))
     if chk:
         chk = unhexlify(chk.encode("ascii"))
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #6
0
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     if rounds.startswith("0"):
         raise ValueError("invalid sha1-crypt hash (zero-padded rounds)")
     return cls(
         rounds=int(rounds),
         salt=salt,
         checksum=chk,
         strict=bool(chk),
     )
コード例 #7
0
ファイル: pbkdf2.py プロジェクト: GabrielDiniz/FluxNetControl
 def from_string(cls, hash):
     if not hash:
         raise ValueError("no hash specified")
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     if rounds.startswith("0"): #zero not allowed, nor left-padded with zeroes
         raise ValueError("invalid dlitz_pbkdf2_sha1 hash")
     rounds = int(rounds, 16) if rounds else 400
     return cls(
         rounds=rounds,
         salt=salt,
         checksum=chk,
         strict=bool(chk),
     )
コード例 #8
0
 def from_string(cls, hash):
     if not hash:
         raise ValueError("no hash specified")
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     if rounds.startswith(
             "0"):  #zero not allowed, nor left-padded with zeroes
         raise ValueError("invalid dlitz_pbkdf2_sha1 hash")
     rounds = int(rounds, 16) if rounds else 400
     return cls(
         rounds=rounds,
         salt=salt,
         checksum=chk,
         strict=bool(chk),
     )
コード例 #9
0
ファイル: pbkdf2.py プロジェクト: GabrielDiniz/FluxNetControl
 def from_string(cls, hash):
     if not hash:
         raise ValueError("no hash specified")
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     int_rounds = int(rounds)
     if rounds != unicode(int_rounds): #forbid zero padding, etc.
         raise ValueError("invalid %s hash" % (cls.name,))
     raw_salt = adapted_b64_decode(salt.encode("ascii"))
     raw_chk = adapted_b64_decode(chk.encode("ascii")) if chk else None
     return cls(
         rounds=int_rounds,
         salt=raw_salt,
         checksum=raw_chk,
         strict=bool(raw_chk),
     )
コード例 #10
0
 def from_string(cls, hash):
     if not hash:
         raise ValueError("no hash specified")
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     int_rounds = int(rounds)
     if rounds != unicode(int_rounds):  #forbid zero padding, etc.
         raise ValueError("invalid %s hash" % (cls.name, ))
     raw_salt = adapted_b64_decode(salt.encode("ascii"))
     raw_chk = adapted_b64_decode(chk.encode("ascii")) if chk else None
     return cls(
         rounds=int_rounds,
         salt=raw_salt,
         checksum=raw_chk,
         strict=bool(raw_chk),
     )
コード例 #11
0
ファイル: pbkdf2.py プロジェクト: GabrielDiniz/FluxNetControl
 def from_string(cls, hash):
     if not hash:
         raise ValueError("no hash specified")
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     if rounds.startswith("0"):
         #passlib deviation: forbidding
         #left-padded with zeroes
         raise ValueError("invalid cta_pbkdf2_sha1 hash")
     rounds = int(rounds, 16)
     salt = b64decode(salt.encode("ascii"), CTA_ALTCHARS)
     if chk:
         chk = b64decode(chk.encode("ascii"), CTA_ALTCHARS)
     return cls(
         rounds=rounds,
         salt=salt,
         checksum=chk,
         strict=bool(chk),
     )
コード例 #12
0
 def from_string(cls, hash):
     if not hash:
         raise ValueError("no hash specified")
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, cls.name)
     if rounds.startswith("0"):
         #passlib deviation: forbidding
         #left-padded with zeroes
         raise ValueError("invalid cta_pbkdf2_sha1 hash")
     rounds = int(rounds, 16)
     salt = b64decode(salt.encode("ascii"), CTA_ALTCHARS)
     if chk:
         chk = b64decode(chk.encode("ascii"), CTA_ALTCHARS)
     return cls(
         rounds=rounds,
         salt=salt,
         checksum=chk,
         strict=bool(chk),
     )
コード例 #13
0
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, handler=cls)
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #14
0
ファイル: django.py プロジェクト: bbBradenbb/gae-starter-kit
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, handler=cls)
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #15
0
ファイル: pbkdf2.py プロジェクト: Aravs7/ubtz2
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, rounds_base=16,
                                      default_rounds=400, handler=cls)
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #16
0
ファイル: pbkdf2.py プロジェクト: MadAd360/GoGramming
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, handler=cls)
     salt = ab64_decode(salt.encode("ascii"))
     if chk:
         chk = ab64_decode(chk.encode("ascii"))
     return cls(rounds=rounds, salt=salt, checksum=chk)
コード例 #17
0
ファイル: pbkdf2.py プロジェクト: Aravs7/ubtz2
 def from_string(cls, hash):
     rounds, salt, chk = uh.parse_mc3(hash, cls.ident, handler=cls)
     salt = ab64_decode(salt.encode("ascii"))
     if chk:
         chk = ab64_decode(chk.encode("ascii"))
     return cls(rounds=rounds, salt=salt, checksum=chk)