from blake3 import blake3 from tqdm.auto import tqdm def compute_file_hash_black3(self, file_path): """Compute BLAKE3 hash of the file""" try: hasher = blake3() with open(file_path, "rb") as f: while chunk := f.read(65536): hasher.update(chunk) return hasher.hexdigest() except Exception as e: # self.stdout.write(self.style.WARNING(f"Error computing file hash: {e}")) tqdm.write(self.style.WARNING(f"Error computing file hash: {e}")) return None def compute_string_hash_black3(self, string): """Compute BLAKE3 hash of the string""" try: hasher = blake3() hasher.update(string.encode()) return hasher.hexdigest() except Exception as e: # self.stdout.write(self.style.WARNING(f"Error computing string hash: {e}")) tqdm.write(self.style.WARNING(f"Error computing string hash: {e}")) return None