Update md5 to sha3256

This commit is contained in:
Rip&Tear
2024-10-27 18:16:03 +08:00
parent 263544524d
commit 16524ccfa8
8 changed files with 37 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
import hashlib
from hashlib import sha256
from typing import Any, List, Optional
from crewai.agents.agent_builder.base_agent import BaseAgent
@@ -32,5 +32,5 @@ def test_key():
goal="test goal",
backstory="test backstory",
)
hash = hashlib.md5("test role|test goal|test backstory".encode()).hexdigest()
hash = sha256("test role|test goal|test backstory".encode()).hexdigest()
assert agent.key == hash

View File

@@ -1,6 +1,6 @@
"""Test Agent creation and execution basic functionality."""
import hashlib
from hashlib import sha256
import json
from concurrent.futures import Future
from unittest import mock
@@ -2328,7 +2328,7 @@ def test_key():
process=Process.sequential,
tasks=tasks,
)
hash = hashlib.md5(
hash = sha256(
f"{researcher.key}|{writer.key}|{tasks[0].key}|{tasks[1].key}".encode()
).hexdigest()
@@ -2368,7 +2368,7 @@ def test_key_with_interpolated_inputs():
process=Process.sequential,
tasks=tasks,
)
hash = hashlib.md5(
hash = sha256(
f"{researcher.key}|{writer.key}|{tasks[0].key}|{tasks[1].key}".encode()
).hexdigest()

View File

@@ -1,6 +1,6 @@
"""Test Agent creation and execution basic functionality."""
import hashlib
from hashlib import sha256
import json
import os
from unittest.mock import MagicMock, patch
@@ -819,7 +819,7 @@ def test_key():
description=original_description,
expected_output=original_expected_output,
)
hash = hashlib.md5(
hash = sha256(
f"{original_description}|{original_expected_output}".encode()
).hexdigest()