HEaaN
Crypto Lab's great homomorphic encryption library
Public Member Functions | Private Attributes | List of all members
HEaaN::EnDecoder Class Reference

Class containing functions dealing with message/plaintext encoding and decoding. More...

#include <EnDecoder.hpp>

Public Member Functions

 EnDecoder (const Context &context)
 
Plaintext encode (const Message &msg, u64 level, int r_counter=0) const
 Encode a message into a plaintext at a certain level at a certain rescale counter. More...
 
Plaintext encode (const Message &msg) const
 Encode a message into a plaintext with the maximal supported level of the current context. More...
 
Plaintext encodeWithoutNTT (const Message &msg, u64 level, int r_counter=0) const
 Encode a message into a plaintext at a certain level at a certain rescale counter, without performing NTT. More...
 
Plaintext encodeWithoutNTT (const Message &msg) const
 Encode a message into a plaintext with the maximal supported level of the current context, without performing NTT. More...
 
Message decode (const Plaintext &ptxt) const
 Decode a plaintext into a message. More...
 

Private Attributes

const Context context_
 A context with which the scheme is associated. More...
 

Detailed Description

Class containing functions dealing with message/plaintext encoding and decoding.

Constructor & Destructor Documentation

◆ EnDecoder()

HEaaN::EnDecoder::EnDecoder ( const Context context)
explicit

Member Function Documentation

◆ decode()

Message HEaaN::EnDecoder::decode ( const Plaintext ptxt) const

Decode a plaintext into a message.

Parameters
[in]ptxtInput plaintext.
Returns
Decoded message.

◆ encode() [1/2]

Plaintext HEaaN::EnDecoder::encode ( const Message msg) const

Encode a message into a plaintext with the maximal supported level of the current context.

Parameters
[in]msgInput message
Returns
Encoded plaintext.

Encode to the default encryption level.

Exceptions
RuntimeExceptionif neither the size of the input message is a power of two, nor it exceeds one half of the ciphertext dimension of the current homomorphic encryption context.

◆ encode() [2/2]

Plaintext HEaaN::EnDecoder::encode ( const Message msg,
u64  level,
int  r_counter = 0 
) const

Encode a message into a plaintext at a certain level at a certain rescale counter.

Parameters
[in]msgInput message
[in]levelTarget level to which msg is to be encoded
[in]r_counterTarget rescale counter to which msg is to be encoded
Returns
Encoded plaintext.

All the real and imaginary parts of the slot values in msg should not exceed 2^(64). The output plaintext is in NTT form, which can be directly used in polynomial multiplication. The size of msg should be a power of two, being less than or equal to half of the dimension of the current context.

Exceptions
RuntimeExceptionif neither the size of the input message is a power of two, nor it exceeds one half of the ciphertext dimension of the current homomorphic encryption context.
RuntimeExceptionif the target level exceeds the maximal level decided in the homomorphic encryption context.
RuntimeExceptionif the target rescale counter exceeds the target level.

◆ encodeWithoutNTT() [1/2]

Plaintext HEaaN::EnDecoder::encodeWithoutNTT ( const Message msg) const

Encode a message into a plaintext with the maximal supported level of the current context, without performing NTT.

Parameters
[in]msgInput message.
Returns
Encoded plaintext.
Exceptions
RuntimeExceptionif neither the size of the input message is a power of two, nor it exceeds one half of the ciphertext dimension of the current homomorphic encryption context.

◆ encodeWithoutNTT() [2/2]

Plaintext HEaaN::EnDecoder::encodeWithoutNTT ( const Message msg,
u64  level,
int  r_counter = 0 
) const

Encode a message into a plaintext at a certain level at a certain rescale counter, without performing NTT.

Parameters
[in]msgInput message.
[in]levelTarget level to which the input msg is to be encoded.
[in]r_counterTarget rescale counter to which msg is to be encoded
Returns
Encoded plaintext.
Exceptions
RuntimeExceptionif neither the size of the input message is a power of two, nor it exceeds one half of the ciphertext dimension of the current homomorphic encryption context.
RuntimeExceptionif the target level exceeds the maximal level decided in the homomorphic encryption context.
RuntimeExceptionif the target rescale counter exceeds the target level

Member Data Documentation

◆ context_

const Context HEaaN::EnDecoder::context_
private

A context with which the scheme is associated.


The documentation for this class was generated from the following file: