Skip to content

ISCC - Instance-Code#

A data checksum.

gen_instance_code(stream, bits = 64) #

Create an ISCC Instance-Code with the latest standard algorithm.

:param Stream stream: Binary data stream for Instance-Code generation :param int bits: Bit-length resulting Instance-Code (multiple of 64) :return: ISCC object with properties: iscc, datahash, filesize :rtype: dict

gen_instance_code_v0(stream, bits = 64) #

Create an ISCC Instance-Code with algorithm v0.

:param Stream stream: Binary data stream for Instance-Code generation :param int bits: Bit-length of resulting Instance-Code (multiple of 64) :return: ISCC object with Instance-Code and properties: datahash, filesize :rtype: dict

hash_instance_v0(stream) #

Create 256-bit hash digest for the Instance-Code body

:param Stream stream: Binary data stream for hash generation. :return: 256-bit Instance-Hash digest used as body of Instance-Code :rtype: bytes

InstanceHasher #

Incremental Instance-Hash generator.

push(self, data) #

Push data to the Instance-Hash generator.

:param Data data: Data to be hashed

digest(self) #

Return Instance-Hash

:return: Instance-Hash digest :rtype: bytes

multihash(self) #

Return blake3 multihash

:return: Blake3 hash as 256-bit multihash :rtype: str

code(self, bits = 64) #

Encode digest as an ISCC Instance-Code unit.

:param int bits: Number of bits for the ISCC Instance-Code :return: ISCC Instance-Code :rtype: str

InstanceHasherV0 #

Incremental Instance-Hash generator.

push(self, data) #

Push data to the Instance-Hash generator.

:param Data data: Data to be hashed

digest(self) #

Return Instance-Hash

:return: Instance-Hash digest :rtype: bytes

multihash(self) #

Return blake3 multihash

:return: Blake3 hash as 256-bit multihash :rtype: str

code(self, bits = 64) #

Encode digest as an ISCC Instance-Code unit.

:param int bits: Number of bits for the ISCC Instance-Code :return: ISCC Instance-Code :rtype: str