encode: Encode or decode a plaintext

View source: R/object-accessors.R

encodeR Documentation

Encode or decode a plaintext

Description

A plaintext holds a value and its encoding as a ring element. The functions that make plaintexts encode them, and decrypt() decodes its result, so these are for code that manipulates the element directly.

Usage

encode(pt)

decode(
  pt,
  depth = NULL,
  scaling_factor = NULL,
  scal_tech = NULL,
  execution_mode = NULL
)

Arguments

pt

A Plaintext.

depth

Integer; the noise scale degree of the ciphertext.

scaling_factor

Numeric; its scaling factor.

scal_tech

A member of ScalingTechnique.

execution_mode

A member of ExecutionMode.

Details

encode() computes the element from the value and decode() the value from the element. The CKKS form of decode() takes what the decoder needs to know about the ciphertext the plaintext came from; give all four arguments or none. The result of decrypt() is already decoded, and decoding it again does not reproduce its value.

Value

TRUE on success.


openfhe.R documentation built on Nov. 13, 2026, 5:07 p.m.