Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/requests/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,31 +145,31 @@
def md5_utf8(x):
if isinstance(x, str):
x = x.encode("utf-8")
return hashlib.md5(x).hexdigest()
return hashlib.md5(x, usedforsecurity=False).hexdigest()

hash_utf8 = md5_utf8
elif _algorithm == "SHA":

def sha_utf8(x):
if isinstance(x, str):
x = x.encode("utf-8")
return hashlib.sha1(x).hexdigest()
return hashlib.sha1(x, usedforsecurity=False).hexdigest()

hash_utf8 = sha_utf8
elif _algorithm == "SHA-256":

def sha256_utf8(x):
if isinstance(x, str):
x = x.encode("utf-8")
return hashlib.sha256(x).hexdigest()
return hashlib.sha256(x, usedforsecurity=False).hexdigest()

hash_utf8 = sha256_utf8
elif _algorithm == "SHA-512":

def sha512_utf8(x):
if isinstance(x, str):
x = x.encode("utf-8")
return hashlib.sha512(x).hexdigest()
return hashlib.sha512(x, usedforsecurity=False).hexdigest()

hash_utf8 = sha512_utf8

Expand Down Expand Up @@ -202,7 +202,7 @@
s += time.ctime().encode("utf-8")
s += os.urandom(8)

cnonce = hashlib.sha1(s).hexdigest()[:16]
cnonce = hashlib.sha1(s, usedforsecurity=False).hexdigest()[:16]
if _algorithm == "MD5-SESS":
HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}")

Expand Down
Loading