uranusjr commented on code in PR #28846:
URL: https://github.com/apache/airflow/pull/28846#discussion_r1066606000


##########
airflow/models/serialized_dag.py:
##########
@@ -102,7 +102,7 @@ def __init__(self, dag: DAG, processor_subdir: str | None = 
None):
         dag_data = SerializedDAG.to_dict(dag)
         dag_data_json = json.dumps(dag_data, sort_keys=True).encode("utf-8")
 
-        self.dag_hash = hashlib.md5(dag_data_json).hexdigest()
+        self.dag_hash = hashlib.new("md5", data=dag_data_json, 
usedforsecurity=False).hexdigest()

Review Comment:
   ```suggestion
           self.dag_hash = hashlib.md5(dag_data_json, 
usedforsecurity=False).hexdigest()
   ```
   
   The argument is available in all algorithms in hashlib, and according to the 
documentation:
   
   > The named constructors are much faster than `new()` and should be 
preferred.
   
   https://docs.python.org/3/library/hashlib.html#hashlib.new



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to