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 = ic.core_opts.mixed_bits)
#
Create an ISCC Content-Code Mixed with the latest standard algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
codes |
Iterable[str]
|
a list of Content-Codes. |
required |
bits |
int
|
Target bit-length of generated Content-Code-Mixed. |
ic.core_opts.mixed_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with Content-Code Mixed. |
gen_mixed_code_v0(codes, bits = ic.core_opts.mixed_bits)
#
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
codes |
Iterable[str]
|
a list of Content-Codes. |
required |
bits |
int
|
Target bit-length of generated Content-Code-Mixed. |
ic.core_opts.mixed_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with Content-Code Mixed. |
soft_hash_codes_v0(cc_digests, bits = ic.core_opts.mixed_bits)
#
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
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cc_digests |
Sequence[bytes]
|
a list of Content-Code digests. |
required |
bits |
int
|
Target bit-length of generated Content-Code-Mixed. |
ic.core_opts.mixed_bits
|
Returns:
Type | Description |
---|---|
bytes
|
Similarity preserving byte hash. |