@@ -166,20 +166,20 @@ def safe_extract_member(member, extract_to):
166166 return full_path
167167
168168
169- def check_hash (filepath : PathLike , val : str | None = None , hash_type : str = "md5 " ) -> bool :
169+ def check_hash (filepath : PathLike , val : str | None = None , hash_type : str = "sha256 " ) -> bool :
170170 """
171171 Verify hash signature of specified file.
172172
173173 Args:
174174 filepath: path of source file to verify hash value.
175175 val: expected hash value of the file.
176- hash_type: type of hash algorithm to use, default is `"md5 "`.
176+ hash_type: type of hash algorithm to use, default is `"sha256 "`.
177177 The supported hash types are `"md5"`, `"sha1"`, `"sha256"`, `"sha512"`.
178178 See also: :py:data:`monai.apps.utils.SUPPORTED_HASH_TYPES`.
179179
180180 """
181181 if val is None :
182- logger . info (f"Expected { hash_type } is None, skip { hash_type } check for file { filepath } ." )
182+ warnings . warn (f"No hash value provided for { filepath } ; file integrity is NOT verified." , stacklevel = 2 )
183183 return True
184184 actual_hash_func = look_up_option (hash_type .lower (), SUPPORTED_HASH_TYPES )
185185
@@ -204,7 +204,7 @@ def download_url(
204204 url : str ,
205205 filepath : PathLike = "" ,
206206 hash_val : str | None = None ,
207- hash_type : str = "md5 " ,
207+ hash_type : str = "sha256 " ,
208208 progress : bool = True ,
209209 ** gdown_kwargs : Any ,
210210) -> None :
@@ -217,7 +217,8 @@ def download_url(
217217 If undefined, `os.path.basename(url)` will be used.
218218 hash_val: expected hash value to validate the downloaded file.
219219 if None, skip hash validation.
220- hash_type: 'md5' or 'sha1', defaults to 'md5'.
220+ hash_type: type of hash algorithm to use, default is `"sha256"`.
221+ The supported hash types are `"md5"`, `"sha1"`, `"sha256"`, `"sha512"`.
221222 progress: whether to display a progress bar.
222223 gdown_kwargs: other args for `gdown` except for the `url`, `output` and `quiet`.
223224 these args will only be used if download from google drive.
@@ -315,7 +316,7 @@ def extractall(
315316 filepath : PathLike ,
316317 output_dir : PathLike = "." ,
317318 hash_val : str | None = None ,
318- hash_type : str = "md5 " ,
319+ hash_type : str = "sha256 " ,
319320 file_type : str = "" ,
320321 has_base : bool = True ,
321322) -> None :
@@ -328,7 +329,7 @@ def extractall(
328329 output_dir: target directory to save extracted files.
329330 hash_val: expected hash value to validate the compressed file.
330331 if None, skip hash validation.
331- hash_type: 'md5' or 'sha1', defaults to 'md5' .
332+ hash_type: type of hash algorithm to use, default is `"sha256"` .
332333 file_type: string of file type for decompressing. Leave it empty to infer the type from the filepath basename.
333334 has_base: whether the extracted files have a base folder. This flag is used when checking if the existing
334335 folder is a result of `extractall`, if it is, the extraction is skipped. For example, if A.zip is unzipped
@@ -394,7 +395,7 @@ def download_and_extract(
394395 filepath : PathLike = "" ,
395396 output_dir : PathLike = "." ,
396397 hash_val : str | None = None ,
397- hash_type : str = "md5 " ,
398+ hash_type : str = "sha256 " ,
398399 file_type : str = "" ,
399400 has_base : bool = True ,
400401 progress : bool = True ,
@@ -410,7 +411,7 @@ def download_and_extract(
410411 default is the current directory.
411412 hash_val: expected hash value to validate the downloaded file.
412413 if None, skip hash validation.
413- hash_type: 'md5' or 'sha1', defaults to 'md5' .
414+ hash_type: type of hash algorithm to use, default is `"sha256"` .
414415 file_type: string of file type for decompressing. Leave it empty to infer the type from url's base file name.
415416 has_base: whether the extracted files have a base folder. This flag is used when checking if the existing
416417 folder is a result of `extractall`, if it is, the extraction is skipped. For example, if A.zip is unzipped
0 commit comments