code: def addnet_hash_safetensors(b):
      """kohya-ss hash for safetensors from https://github.com/kohya-ss/sd-scripts/blob/main/library/train_util.py"""
      hash_sha256 = hashlib.sha256()
      blksize = 1024 * 1024
  
      b.seek(0)
      header = b.read(8)
      n = int.from_bytes(header, "little")
  
      offset = n + 8
      b.seek(offset)
      for chunk in iter(lambda: b.read(blksize), b""):
          hash_sha256.update(chunk)
  
      return hash_sha256.hexdigest()
  
file_path: stable-diffusion-webui/modules/hashes.py
imports: import hashlib
  import os.path
  from modules import shared
  import modules.cache
label_desc: Use image node_id 4 for calling a global function with example usage: addnet_hash_safetensors(b) and returns: hash_sha256