ISCC - Instance-Code#
A data checksum.
gen_instance_code(stream, bits = ic.core_opts.instance_bits)
#
Create an ISCC Instance-Code with the latest standard algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream |
Stream
|
Binary data stream for Instance-Code generation |
required |
bits |
int
|
Bit-length resulting Instance-Code (multiple of 64) |
ic.core_opts.instance_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC object with properties: iscc, datahash, filesize |
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 |
hash_instance_v0(stream)
#
Create 256-bit hash digest for the Instance-Code body
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream |
Stream
|
Binary data stream for hash generation. |
required |
Returns:
Type | Description |
---|---|
bytes
|
256-bit Instance-Hash digest used as body of Instance-Code |
InstanceHasherV0
#
Incremental Instance-Hash generator.
push(data)
#
Push data to the Instance-Hash generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
Data to be hashed |
required |
digest()
#
Return Instance-Hash
Returns:
Type | Description |
---|---|
bytes
|
Instance-Hash digest |
multihash()
#
Return blake3 multihash
Returns:
Type | Description |
---|---|
str
|
Blake3 hash as 256-bit multihash |
code(bits = ic.core_opts.instance_bits)
#
Encode digest as an ISCC Instance-Code unit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bits |
int
|
Number of bits for the ISCC Instance-Code |
ic.core_opts.instance_bits
|
Returns:
Type | Description |
---|---|
str
|
ISCC Instance-Code |