Skip to content

Commit

Permalink
Replace the MD5 usage by SHA256
Browse files Browse the repository at this point in the history
MD5 is old, insecure, and can create problems for people using this package when they are trying to pass some compliance requirements (for example, FIPS).
  • Loading branch information
RenanGBarreto authored Jul 8, 2022
1 parent 0be56b3 commit 029bdfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ def parse_error(cls, error: Optional[Union[Exception, str]]) -> str:
@classmethod
def create_key(cls, method: str, name: str, error: Optional[Union[Exception, str]]) -> str:
key = f"{method}.{name}.{StatsError.parse_error(error)!r}"
return hashlib.md5(key.encode("utf-8")).hexdigest()
return hashlib.sha256(key.encode("utf-8")).hexdigest()

def occurred(self) -> None:
self.occurrences += 1
Expand Down

0 comments on commit 029bdfe

Please sign in to comment.