Skip to content

Latest commit

 

History

History
171 lines (91 loc) · 4.5 KB

concrete.fhe.compilation.client.md

File metadata and controls

171 lines (91 loc) · 4.5 KB

module concrete.fhe.compilation.client

Declaration of Client class.


class Client

Client class, which can be used to manage keys, encrypt arguments and decrypt results.

method __init__

__init__(
    client_specs: ClientSpecs,
    keyset_cache_directory: Optional[Path, str] = None
)

property evaluation_keys

Get evaluation keys for encrypted computation.

Returns: EvaluationKeys evaluation keys for encrypted computation


property keys

Get the keys for the client.


method decrypt

decrypt(
    *results: Union[Value, Tuple[Value, ]],
    function_name: str = 'main'
) → Union[int, ndarray, Tuple[Union[int, ndarray, NoneType], ], NoneType]

Decrypt result(s) of evaluation.

Args: *results (Union[Value, Tuple[Value, ...]]): result(s) of evaluation function_name (str): name of the function to decrypt for

Returns: Optional[Union[int, np.ndarray, Tuple[Optional[Union[int, np.ndarray]], ...]]]: decrypted result(s) of evaluation


method encrypt

encrypt(
    *args: Optional[int, ndarray, List],
    function_name: str = 'main'
) → Union[Value, Tuple[Optional[Value], ], NoneType]

Encrypt argument(s) to for evaluation.

Args: *args (Optional[Union[int, np.ndarray, List]]): argument(s) for evaluation function_name (str): name of the function to encrypt

Returns: Optional[Union[Value, Tuple[Optional[Value], ...]]]: encrypted argument(s) for evaluation


method keygen

keygen(
    force: bool = False,
    seed: Optional[int] = None,
    encryption_seed: Optional[int] = None
)

Generate keys required for homomorphic evaluation.

Args: force (bool, default = False): whether to generate new keys even if keys are already generated

seed (Optional[int], default = None): seed for private keys randomness

encryption_seed (Optional[int], default = None): seed for encryption randomness


method load

load(
    path: Union[str, Path],
    keyset_cache_directory: Optional[Path, str] = None
) → Client

Load the client from the given path in zip format.

Args: path (Union[str, Path]): path to load the client from

keyset_cache_directory (Optional[Union[str, Path]], default = None): keyset cache directory to use

Returns: Client: client loaded from the filesystem


method save

save(path: Union[str, Path])

Save the client into the given path in zip format.

Args: path (Union[str, Path]): path to save the client