Skip to content

Commit 939a172

Browse files
committed
Use BLAKE2 instead of MD5
1 parent 63c9fd5 commit 939a172

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async def index():
173173

174174
By default the `default_key_builder` builtin key builder is used; this creates a
175175
cache key from the function module and name, and the positional and keyword
176-
arguments converted to their `repr()` representations, encoded as a MD5 hash.
176+
arguments converted to their `repr()` representations, encoded as a BLAKE2 hash.
177177
You can provide your own by passing a key builder in to `@cache()`, or to
178178
`FastAPICache.init()` to apply globally.
179179

fastapi_cache/key_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def default_key_builder(
1414
args: Tuple[Any, ...],
1515
kwargs: Dict[str, Any],
1616
) -> str:
17-
cache_key = hashlib.md5( # noqa: S324
17+
cache_key = hashlib.blake2b(
1818
f"{func.__module__}:{func.__name__}:{args}:{kwargs}".encode()
1919
).hexdigest()
2020
return f"{namespace}:{cache_key}"

0 commit comments

Comments
 (0)