LION/utils/io_helper.py

18 lines
704 B
Python
Raw Normal View History

2023-01-23 05:14:49 +00:00
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
import hashlib
import json
def hash_str(file_name):
BUF_SIZE = 65536 # lets read stuff in 64kb chunks!
md5 = hashlib.md5()
data = file_name
md5.update(data.encode())
hash_str = md5.hexdigest()[:6]
return hash_str