ISCC - ISO Reference#
The following functions are the reference implementations of ISO 24138:
ISO 24138 / 5.1 Meta-Code#
gen_meta_code_v0(name, description=None, meta=None, bits=ic.core_opts.meta_bits)
#Create an ISCC Meta-Code with the algorithm version 0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name or title of the work manifested by the digital asset |
required |
description |
Optional[str]
|
Optional description for disambiguation |
None
|
meta |
Optional[Union[dict,str]
|
Dict or Data-URL string with extended metadata |
None
|
bits |
int
|
Bit-length of resulting Meta-Code (multiple of 64) |
ic.core_opts.meta_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with possible fields: iscc, name, description, metadata, metahash |
Source code in iscc_core\code_meta.py
ISO 24138 / 5.3 Text-Code#
gen_text_code_v0(text, bits=ic.core_opts.text_bits)
#Create an ISCC Text-Code with algorithm v0.
Note
Any markup (like HTML tags or markdown) should be removed from the plain-text before passing it to this function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text for Text-Code creation |
required |
bits |
int
|
Bit-length of ISCC Code Hash (default 64) |
ic.core_opts.text_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC schema instance with Text-Code and an aditional property |
Source code in iscc_core\code_content_text.py
ISO 24138 / 5.4 Image-Code#
gen_image_code_v0(pixels, bits=ic.core_opts.image_bits)
#Create an ISCC Content-Code Image with algorithm v0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixels |
Sequence[int]
|
Normalized image pixels (32x32 flattened gray values) |
required |
bits |
int
|
Bit-length of ISCC Content-Code Image (default 64). |
ic.core_opts.image_bits
|
Returns:
Type | Description |
---|---|
ISCC
|
ISCC object with Content-Code Image. |
Source code in iscc_core\code_content_image.py
ISO 24138 / 5.5 Audio-Code#
gen_audio_code_v0(cv, bits=ic.core_opts.audio_bits)
#Create an ISCC Content-Code Audio with algorithm v0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cv |
Iterable[int]
|
Chromaprint vector |
required |
bits |
int
|
Bit-length resulting Content-Code Audio (multiple of 64) |
ic.core_opts.audio_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with Content-Code Audio |
Source code in iscc_core\code_content_audio.py
ISO 24138 / 5.6 Video-Code#
gen_video_code_v0(frame_sigs, bits=ic.core_opts.video_bits)
#Create an ISCC Video-Code with algorithm v0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_sigs |
ic.FrameSig
|
Sequence of MP7 frame signatures |
required |
bits |
int
|
Bit-length resulting Video-Code (multiple of 64) |
ic.core_opts.video_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with Video-Code |
Source code in iscc_core\code_content_video.py
ISO 24138 / 5.7 Mixed-Code#
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. |
Source code in iscc_core\code_content_mixed.py
ISO 24138 / 5.8 Data-Code#
gen_data_code_v0(stream, bits=ic.core_opts.data_bits)
#Create an ISCC Data-Code with algorithm v0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream |
Stream
|
Input data stream. |
required |
bits |
int
|
Bit-length of ISCC Data-Code (default 64). |
ic.core_opts.data_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with Data-Code |
Source code in iscc_core\code_data.py
ISO 24138 / 5.9 Instance-Code#
gen_instance_code_v0(stream, bits=ic.core_opts.instance_bits)
#Create an ISCC Instance-Code with algorithm v0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream |
Stream
|
Binary data stream for Instance-Code generation |
required |
bits |
int
|
Bit-length of resulting Instance-Code (multiple of 64) |
ic.core_opts.instance_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with Instance-Code and properties: datahash, filesize |
Source code in iscc_core\code_instance.py
ISO 24138 / 6.0 ISCC-CODE#
gen_iscc_code_v0(codes)
#Combine multiple ISCC-UNITS to an ISCC-CODE with a common header using algorithm v0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
codes |
Sequence[str]
|
A valid sequence of singluar ISCC-UNITS. |
required |
Returns:
Type | Description |
---|---|
dict
|
An ISCC object with ISCC-CODE |