ISCC - Data-Code#
A similarity perserving hash for binary data (soft hash).
gen_data_code(stream, bits = ic.core_opts.data_bits)
#
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). |
ic.core_opts.data_bits
|
Returns:
Type | Description |
---|---|
dict
|
ISCC 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 |
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 |
DataHasherV0
#
Incremental Data-Hash generator.
__init__(data = None)
#
Create a DataHasher
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Optional[Data]
|
initial payload for hashing. |
None
|
push(data)
#
Push data to the Data-Hash generator.
digest()
#
Calculate 256-bit minhash digest from feature hashes.
code(bits = ic.core_opts.data_bits)
#
Encode digest as an ISCC Data-Code unit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bits |
int
|
Number of bits for the ISCC Data-Code |
ic.core_opts.data_bits
|
Returns:
Type | Description |
---|---|
str
|
ISCC Data-Code |