Skip to content

ISCC - Mixed Code#

A similarity hash for mixed media content.

Creates an ISCC object that provides a iscc-field a Mixed-Code and a parts-field that lists the input codes.

Many digital assets embed multiple assets of different mediatypes in a single file. Text documents may include images, video includes audio in most cases. The ISCC Content-Code-Mixed encodes the similarity of a collection of assets of the same or different mediatypes that may occur in a multimedia asset.

Applications that create mixed Content-Codes must be capable to extract embedded assets and create individual Content-Codes per asset.

gen_mixed_code(codes, bits = 64) #

Create an ISCC Content-Code Mixed with the latest standard algorithm.

:param Iterable[str] codes: a list of Content-Codes. :param int bits: Target bit-length of generated Content-Code-Mixed. :return: ISCC object with Content-Code Mixed. :rtype: dict

gen_mixed_code_v0(codes, bits = 64) #

Create an ISCC Content-Code-Mixed with algorithm v0.

If the provided codes are of mixed length they are stripped to bits length for calculation.

:param Iterable[str] codes: a list of Content-Codes. :param int bits: Target bit-length of generated Content-Code-Mixed. :return: ISCC object with Content-Code Mixed. :rtype: dict

soft_hash_codes_v0(cc_digests, bits = 64) #

Create a similarity hash from multiple Content-Code digests.

The similarity hash is created from the bodies of the input codes with the first byte of the code-header prepended.

All codes must be of main-type CONTENT and have a minimum length of bits.

:param Sequence[bytes] cc_digests: a list of Content-Code digests. :param int bits: Target bit-length of generated Content-Code-Mixed. :return: Similarity preserving byte hash. :rtype: bytes