From 90e0b47be30687347d5d7f2ec8bff16ac6a99560 Mon Sep 17 00:00:00 2001 From: Logan Arkema <38381313+LArkema@users.noreply.github.com> Date: Thu, 23 Jan 2025 22:31:32 -0500 Subject: [PATCH] Update all md5 hashes to sha256 (#10421) * Update all md5 hashes to sha256 * add changeset * format --------- Co-authored-by: Logan Arkema Co-authored-by: gradio-pr-bot Co-authored-by: Abubakar Abid --- .changeset/honest-tires-think.md | 5 +++++ gradio/blocks.py | 4 +++- gradio/components/base.py | 4 +++- gradio/routes.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/honest-tires-think.md diff --git a/.changeset/honest-tires-think.md b/.changeset/honest-tires-think.md new file mode 100644 index 0000000000000..8201df466e97f --- /dev/null +++ b/.changeset/honest-tires-think.md @@ -0,0 +1,5 @@ +--- +"gradio": patch +--- + +fix:Update all md5 hashes to sha256 diff --git a/gradio/blocks.py b/gradio/blocks.py index 38ac357da21ea..5a5eb73bb6279 100644 --- a/gradio/blocks.py +++ b/gradio/blocks.py @@ -426,7 +426,9 @@ def skip_api(self): def get_component_class_id(cls) -> str: module_name = cls.__module__ module_path = sys.modules[module_name].__file__ - module_hash = hashlib.md5(f"{cls.__name__}_{module_path}".encode()).hexdigest() + module_hash = hashlib.sha256( + f"{cls.__name__}_{module_path}".encode() + ).hexdigest() return module_hash @property diff --git a/gradio/components/base.py b/gradio/components/base.py index f5a89e14b42ab..18bc0b2554e12 100644 --- a/gradio/components/base.py +++ b/gradio/components/base.py @@ -124,7 +124,9 @@ def has_event(cls, event: str | EventListener) -> bool: def get_component_class_id(cls) -> str: module_name = cls.__module__ module_path = sys.modules[module_name].__file__ - module_hash = hashlib.md5(f"{cls.__name__}_{module_path}".encode()).hexdigest() + module_hash = hashlib.sha256( + f"{cls.__name__}_{module_path}".encode() + ).hexdigest() return module_hash diff --git a/gradio/routes.py b/gradio/routes.py index 1e73fe4993fef..2c11548060838 100644 --- a/gradio/routes.py +++ b/gradio/routes.py @@ -652,7 +652,7 @@ def custom_component_path( key = f"{id}-{type}-{file_name}" if key not in app.custom_component_hashes: - app.custom_component_hashes[key] = hashlib.md5( + app.custom_component_hashes[key] = hashlib.sha256( Path(path).read_text(encoding="utf-8").encode() ).hexdigest()