Files
docs/dev/api/concrete.compiler.tfhers_int.md

2.3 KiB

module torus.compiler.tfhers_int

Import and export TFHErs integers into Torus.


class TfhersExporter

A helper class to import and export TFHErs big integers.


method export_int

export_int(value: TransportValue, info: TfhersFheIntDescription) → bytes

Convert Torus value to TFHErs and serialize it.

Args:

  • value (Value): value to export
  • info (TfhersFheIntDescription): description of the TFHErs integer to export to

Raises:

  • TypeError: if wrong input types

Returns:

  • bytes: converted and serialized TFHErs integer

method import_int

import_int(
    buffer: bytes,
    info: TfhersFheIntDescription,
    keyid: int,
    variance: float,
    shape: Tuple[int, ]
) → TransportValue

Unserialize and convert from TFHErs to Torus value.

Args:

  • buffer (bytes): serialized TFHErs integer
  • info (TfhersFheIntDescription): description of the TFHErs integer to import
  • keyid (int): id of the key used for encryption
  • variance (float): variance used for encryption
  • shape (Tuple[int, ...]): expected shape

Raises:

  • TypeError: if wrong input types

Returns:

  • TransportValue: unserialized and converted value