def get_hash()

in components/processing/libs/processor-base/src/processors/base/gcsio.py [0:0]


    def get_hash(self, extra=None) -> str:
        """Get the hash ID of the file or object as a string"""
        # Construct hash string
        hash_data = json.dumps(
            {
                "obj": [self.friendly_path, self.crc32c],
                "extra": extra,
            },
            default=str,
        )

        # Cosntruct the hash
        return (
            "id-"
            + str(
                base64.urlsafe_b64encode(
                    hashlib.sha256(bytes(hash_data, "utf8")).digest()
                ),
                "utf8",
            )[:-1]
        )