Skip to content

ISCC - Data-Code#

A similarity perserving hash for binary data (soft hash).

gen_data_code(stream, bits = 64) #

Create a similarity preserving ISCC Data-Code with the latest standard algorithm.

Parameters:

Name Type Description Default
stream Stream

Input data stream.

required
bits int

Bit-length of ISCC Data-Code (default 64).

64

Returns:

Type Description
dict

ISCC Data-Code

gen_data_code_v0(stream, bits = 64) #

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).

64

Returns:

Type Description
dict

ISCC object with Data-Code

soft_hash_data_v0(stream) #

Create a similarity preserving Data-Hash digest

Parameters:

Name Type Description Default
stream Stream

Input data stream.

required

Returns:

Type Description
bytes

256-bit Data-Hash (soft-hash) digest used as body for Data-Code

DataHasher #

Incremental Data-Hash generator.

__init__(self, data = None) special #

Create a DataHasher

Parameters:

Name Type Description Default
data Optional[Data]

initial payload for hashing.

None

push(self, data) #

Push data to the Data-Hash generator.

digest(self) #

Calculate 256-bit minhash digest from feature hashes.

code(self, bits = 64) #

Encode digest as an ISCC Data-Code component.

Parameters:

Name Type Description Default
bits int

Number of bits for the ISCC Data-Code

64

Returns:

Type Description
str

ISCC Data-Code

DataHasherV0 #

Incremental Data-Hash generator.

__init__(self, data = None) special #

Create a DataHasher

Parameters:

Name Type Description Default
data Optional[Data]

initial payload for hashing.

None

push(self, data) #

Push data to the Data-Hash generator.

digest(self) #

Calculate 256-bit minhash digest from feature hashes.

code(self, bits = 64) #

Encode digest as an ISCC Data-Code component.

Parameters:

Name Type Description Default
bits int

Number of bits for the ISCC Data-Code

64

Returns:

Type Description
str

ISCC Data-Code