zserio.hashcode module

The module provides utility methods for hash code calculation.

zserio.hashcode.calc_hashcode_bool(seed_value: int, value: bool) int[source]

Calculates hash code for a boolean value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_bool_array(seed_value: int, value: List[bool]) int[source]

Calculates hash code for a boolean array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_bytes(seed_value: int, value: bytearray) int[source]

Calculates hash code for a bytes value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_bytes_array(seed_value: int, value: List[bytearray]) int[source]

Calculates hash code for a bytes array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_float32(seed_value: int, value: float) int[source]

Calculates hash code for a 32-bit float value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_float32_array(seed_value: int, value: List[int]) int[source]

Calculates hash code for a 32-bit float array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_float64(seed_value: int, value: float) int[source]

Calculates hash code for a 64-bit float value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_float64_array(seed_value: int, value: List[int]) int[source]

Calculates hash code for a 64-bit float array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_int32(seed_value: int, value: int) int[source]

Calculates hash code for a 32-bit integral value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_int64(seed_value: int, value: int) int[source]

Calculates hash code for a 64-bit integral value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_int_array(seed_value: int, value: List[int]) int[source]

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_object(seed_value: int, value: Any) int[source]

Calculates hash code for an object value.

This is used for all objects (in zserio runtime or generated) which override the default __hash__ method.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_object_array(seed_value: int, value: List[Any]) int[source]

Calculates hash code for an object array value.

This is used for arrays of all objects (in zserio runtime or generated) which override the default __hash__ method.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_string(seed_value: int, value: str) int[source]

Calculates hash code for a string value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

zserio.hashcode.calc_hashcode_string_array(seed_value: int, value: List[str]) int[source]

Calculates hash code for a string array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.