Skip to content

Commit

Permalink
Update all md5 hashes to sha256 (#10421)
Browse files Browse the repository at this point in the history
* Update all md5 hashes to sha256

* add changeset

* format

---------

Co-authored-by: Logan Arkema <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
  • Loading branch information
4 people authored Jan 24, 2025
1 parent 92dda15 commit 90e0b47
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-tires-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Update all md5 hashes to sha256
4 changes: 3 additions & 1 deletion gradio/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion gradio/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion gradio/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 90e0b47

Please sign in to comment.