METHODS AND SYSTEMS FOR P-ADIC ENCODING AND DECODING OF RATIONAL DATA FOR FHE SYSTEMS

Information

  • Patent Application
  • 20240243899
  • Publication Number
    20240243899
  • Date Filed
    December 11, 2023
    a year ago
  • Date Published
    July 18, 2024
    5 months ago
Abstract
Disclosed are methods and systems to provide homomorphic compatible, p-adic arithmetic based encoding and decoding of rational numbers to integers and back to rational numbers for use with existing Fully Homomorphic Encryption (FHE) systems. Embodiments support both Approximate Greatest Common Devisor (AGCD) systems such as those with an Integer—Dijk, Gentry, Halevi, and Vaikuntanathan (IDGHV) scheme, and Ring Learning With Error (RLWE) systems such as a Fan and Vercauteren (FV) scheme modified for encrypting integers (ModFV). Encoded integers are provided to an FHE system on a source device that may optionally deliver the encrypted ciphertext to an intermediary device for performance of homomorphic algebra operations, and, the resultant and/or original ciphertext is delivered to a destination device for decryption of the ciphertext, and decoding of the decrypted integer back to a rational number.
Description
BACKGROUND OF THE INVENTION

The advancement of science is possible when knowledge is shared and information is exchanged in a seamless manner. In a world where many businesses rely on information as their main assets, analysis over data is a crucial competitive advantage. Consequently, the amount of data processed and stored will continue to increase, creating a demand for virtualized services. To this end, some applications can be provided as cloud computing resources including Internet of Things (IoT), machine learning, virtual reality (VR) and blockchain. As a result, concerns about custody and privacy of data are on the rise.


Modern concealment/encryption employs mathematical techniques that manipulate positive integers or binary bits. Asymmetric concealment/encryption, such as RSA (Rivest-Shamir-Adleman), relies on number theoretic one-way functions that are predictably difficult to factor and can be made more difficult with an ever-increasing size of the encryption keys. Symmetric encryption, such as DES (Data Encryption Standard) and AES (Advanced Encryption Standard), uses bit manipulations within registers to shuffle the concealed text/cryptotext/ciphertext to increase “diffusion” as well as register-based operations with a shared key to increase “confusion.” Diffusion and confusion are measures for the increase in statistical entropy on the data payload being transmitted. The concepts of diffusion and confusion in encryption are normally attributed as first being identified by Claude Shannon in the 1940s. Diffusion is generally thought of as complicating the mathematical process of generating unencrypted (plain text) data from the encrypted (cryptotext/ciphertext) data, thus, making it difficult to discover the encryption key of the concealment/encryption process by spreading the influence of each piece of the unencrypted (plain) data across several pieces of the concealed/encrypted (cryptotext) data. Consequently, an encryption system that has a high degree of diffusion will typically change several characters of the concealed/encrypted (cryptotext/ciphertext) data for the change of a single character in the unencrypted (plain) data making it difficult for an attacker to identify changes in the unencrypted (plain) data. Confusion is generally thought of as obscuring the relationship between the unencrypted (plain) data and the concealed/encrypted (cryptotext) data. Accordingly, a concealment/encryption system that has a high degree of confusion would entail a process that drastically changes the unencrypted (plain) data into the concealed/encrypted (cryptotext/ciphertext) data in a way that, even when an attacker knows the operation of the concealment/encryption method (such as the public standards of RSA, DES, and/or AES), it is still difficult to deduce the encryption key.


Homomorphic Encryption is a form of encryption that allows computations to be carried out on concealed ciphertext as it is concealed/encrypted without decrypting the ciphertext that generates a concealed/encrypted result which, when decrypted, matches the result of operations performed on the unencrypted plaintext.


The word homomorphism comes from the ancient Greek language: óμóç (homos) meaning “same” and μoρφ{acute over (η)} (morphe) meaning “form” or “shape.” Homomorphism may have different definitions depending on the field of use. In mathematics, for example, homomorphism may be considered a transformation of a first set into a second set where the relationship between the elements of the first set are preserved in the relationship of the elements of the second set.


For instance, a map f between sets A and B is a homomorphism of A into B if







f

(


a

1





op



a
2


)

=


f

(

a
1

)



op



f

(

a
2

)





"\[LeftBracketingBar]"



a
1

,


a
2


A








where “op” is the respective group operation defining the relationship between A and B.


More specifically, for abstract algebra, the term homomorphism may be a structure-preserving map between two algebraic structures such as groups, rings, or vector spaces. Isomorphisms, automorphisms, and endomorphisms are typically considered special types of homomorphisms. Among other more specific definitions of homomorphism, algebra homomorphism may be considered a homomorphism that preserves the algebra structure between two sets.


SUMMARY OF THE INVENTION

An embodiment of the present invention may comprise a method for Homomorphic Encryption (HE) compatible encoding and decoding of rational data for encrypted data transmission with a Fully Homomorphic Encryption (FHE) system between a source computing device and a destination computing device, the method comprising: encoding by the source computing device at least one rational number x/y into at least one integer corresponding to the at least one rational number x/y as a function of p-adic arithmetic performed on each of the at least one rational number x/y such that the at least one integer retains homomorphic properties; encrypting by the source computing device the at least one integer into at least one ciphertext with the FHE system operating on the source computing device; sending by the source computing device the at least one ciphertext to the destination computing device; decrypting by the destination computing device the at least one ciphertext into the at least one integer with the FHE system operating on the destination computing device; and decoding by the destination computing device the at least one integer into the at least one rational number x/y corresponding to the at least one integer as a function of inverse p-adic arithmetic performed on each of the at least one integer.


An embodiment of the present invention may further comprise a PIE (p-adic encoding) system that encodes and decodes rational data with Homomorphic Encryption (HE) compatibility for encrypted data transmission with a Fully Homomorphic Encryption (FHE) system between a source computing device and a destination computing device, the PIE system comprising: the source computing device, wherein the source device further comprises: a PIE encode subsystem that encodes at least one rational number x/y into at least one integer corresponding to the at least one rational number x/y as a function of p-adic arithmetic performed on each of the at least one rational number x/y such that the at least one integer has homomorphic properties and is HE compatible; the FHE system operating on the source computing device that encrypts the at least one integer into at least one ciphertext; a ciphertext send subsystem that sends the at least one ciphertext to the destination computing device; the destination computing device, wherein the destination computing device further comprises: the FHE system operating on the destination computing device that decrypts the at least one ciphertext into the at least one integer; and a PIE decode subsystem that decodes the at least one integer into the at least one rational number x/y corresponding to the at least one integer as a function of inverse p-adic arithmetic performed on each of the at least one integer.





BRIEF DESCRIPTION OF THE DRAWINGS

In the drawings,



FIG. 1 is a block diagram of the hardware implementation for an embodiment.



FIG. 2 is a flow chart of operations for an embodiment.





DETAILED DESCRIPTION OF THE EMBODIMENTS

A large part of current research in Homomorphic Encryption (HE) aims towards making HE practical for real-world applications. In any practical HE, an important issue is to convert the application data (type) to the data type suitable for the HE.


The main purpose of this work is to investigate an efficient HE-compatible encoding method that is generic, and can be easily adapted to apply to the HE schemes over integers or polynomials.


p-adic number theory provides a way to transform rationals to integers, which makes it a candidate for encoding rationals. Although one may use naive number-theoretic techniques to perform rational-to-integer transformations without reference to p-adic numbers, we contend that the theory of p-adic numbers is the proper lens to view such transformations.


In this work we identify mathematical techniques (supported by p-adic number theory) as appropriate tools to construct a generic rational encoder, which is compatible with HE. Based on these techniques, we propose a new encoding scheme PIE (p-adic encoding) that can be easily combined with both AGCD (Approximate Greatest Common Divisor)-based and RLWE (Ring Learning With Error)-based HE to perform high precision arithmetic. After presenting an abstract version of PIE, we show how it can be attached to two well-known HE schemes: the AGCD-based IDGHV (Integer—Dijk, Gentry, Halevi, and Vaikuntanathan) scheme and the RLWE-based (modified) Fan-Vercauteren (FV) scheme. We also discuss the advantages of our encoding scheme in comparison with previous works.


1 Introduction

Much of current research and development in HE is focused on efficient implementation with suitable software and/or hardware support and developing practically usable libraries for HE that can be used for various machine learning and data analysis applications. These works clearly aim towards making HE practical for real-world applications.


The state-of-the-art HE schemes are defined to process (modulo) integer inputs or polynomial inputs (with modulo integer coefficients). For a significantly large number of practical applications, an HE scheme should be able to operate on real/rational numbers. In any practical HE an important issue is to convert the application data (type) to the data type suitable for the HE. This is usually achieved by encoding real-valued data to convert it into a “suitable” form compatible with homomorphic encryption. Any encoding must come with a matching decoding. Additionally, such an encoding must be homomorphic with respect to addition and multiplication, and injective. Most importantly, any such encoding technique must be efficient and not hinder the efficiency of the underlying HE scheme.


The interest in HE-compatible encoding to process real/rational inputs efficiently is evident from a number of previous works. In most of the RLWE (Ring Learning with Error) hardness-based homomorphic encryption schemes, a plaintext is viewed as an element of the ring Rt=custom-charactert[x]/ϕm(x) where ϕm(x) is the m-th cyclotomic polynomial and custom-charactert is the ring of integers modulo t. Encoding integer input to a polynomial in Rt is relatively straightforward, namely one can consider the base t representation of the integer. For allowing integer and rational inputs one must define encoding converting elements of custom-character or custom-character (typically represented as fixed-point decimal numbers in applications) into elements of Rr. Previous works have proposed several encoding methods for integers and rationals. One previously taken approach is to scale the fixed-point numbers to integers and then encode them as polynomials (using a suitable base). Another approach is to consider them as fractional numbers. It was shown that these two representations are isomorphic. The latter approach, although avoiding the overhead of bookkeeping homomorphic ciphertext, is difficult to analyze.


All of the aforementioned encodings share a problem; namely, t must have a sufficiently large value for the encoding to work correctly. This large value of t means one may need to choose large parameters for the overall homomorphic encryption scheme hindering the efficiency. A clever solution to this problem was proposed by Chen, Len, Player and Xia (CLPX), which borrows a mathematical technique from Hoffstein and Silverman and combines it with the homomorphic encryption scheme proposed by Fan and Vercauteren (FV). The main idea of the so-called CLPX encoding is to replace the modulus t with the polynomial x−b for some positive integer b and turning the plaintext space into the quotient ring custom-character/(bn+1)custom-character. Note that CLPX encoding converts fractional or fixed-point numbers and the scheme combines it with a modified version (which we will call ModFV) of the original FV scheme.


In the CLPX encoding, the rational (input) domain is a finite subset of custom-character and, therefore, is not closed under the usual compositions (addition and multiplication) which can potentially lead to overflow problems. That is, if the composition of two rational inputs lies outside the domain then its decoding (after homomorphic computation) will be incorrect. However, they do not provide any analytical discussion or solution towards solving this problem. The theory behind our encoding, which also transforms fixed-point (decimal) numbers, allows us to provide an analytical solution to this problem.


1.1 Our Results

The main aim of our work is to investigate an efficient HE-compatible encoding method that is generic (not necessarily targeted for a specific HE scheme) and can be easily adapted to apply to the HE schemes over integers or polynomials. The results of this work are as follows:

    • We construct an efficient and generic encoding (and decoding) scheme based on a transformation that stems from p-adic number theory. First, we identify the tools and techniques provided by p-adic number theory to derive the foundational injective transformation that maps rationals to (modulo) integers, and is additively and multiplicatively homomorphic. The encoding scheme follows naturally from this injective transformation. We call this new encoding PIE (p-adic encoding).
    • We use the structural properties of the rational domain (of the abovementioned transformation) to provide a bound on the domain size ensuring that there is no overflow from (additive or multiplicative) composition, thus, causing incorrect decoding. The previous work, did not address this overflow problem.
    • Finally, we demonstrate that our encoding map can be easily applied to both Approximate Greatest Common Divisor (AGCD)-based and RLWE-based (over polynomial rings) HEs using the Batch FHE (Fully Homomorphic Encryption) and the modified Fan-Vercauteren (ModFV) schemes respectively. We also discuss how the (public) parameters of these HEs can be used to setup the parameters of PIE.


We show our encoding scheme allows for a much larger input space compared to the previous encoding schemes for an RLWE-based HE without severely compromising the circuit depth that can be evaluated using the HE. To the best of our knowledge this is the first work discussing an encoding scheme for AGCD-based schemes.


We implemented PIE using C++ (together with proof-of-concept implementations of IDGHV (Batch FHE) and ModFV schemes (FHE part of our implementation is not optimized) to estimate the efficiencies of the encoding and decoding. The results of our experiment are given in Section 6.


2 Notations and Foundations

In this section we introduce the basic ideas and techniques from p-adic number theory that are necessary for developing our encoding scheme. We emphasize that the ideas described in this section are self-contained and do not assume prior knowledge of p-adic number theory.


2.1 Notations.

For a real number r, the functions └r┘, ┌r┐, └r┐ denote the usual “floor”, “ceiling”, and “round-to-nearest-integer” functions. For an integer a, |a|bits denotes the bit length of a. The ring of integers is denoted by custom-character, and the field of rationals by custom-character. For a positive integer n, custom-character/ncustom-character denotes the ring of integers modulo n. In case n is prime, we sometimes write custom-charactern. To distinguish this ring (field) from sets of integer representatives, we denote by custom-charactern the set [−┌(n−1)/2┐, └(n−1)/2┘]⋅custom-character. For integers a, n we denote by a mod n the unique integer ā∈custom-charactern such that n|(a−ā). Similarly, we use the elements of custom-charactern as representatives of the cosets of custom-character/ncustom-character, and sometimes use custom-charactern in place of custom-character/ncustom-character, though in this case we are careful to put “mod n” where appropriate. For a polynomial p, └p┐ and [p]n denote the rounding of each coefficient to the nearest integer, and the reduction of each coefficient modulo n. We use everywhere log(·) in place of log2(·). “Input space” will always mean the set of fractions for which encoding correctness holds, and “message space” always means a subset of the input space for which homomorphic correctness (for arithmetic circuits up to a certain depth) holds.


2.2 Results and Techniques from p-adic Arithmetic.


Roughly speaking, p-adic number theory allows us to represent a rational







x
y






using integers.







If


x
y







and p is a prime then we have:











x
y

=





j
=
n





a
j



p
j



=



a
n



p
n


+


a

n
+
1




p

n
+
1



+





,




Eq
.

1







where 0≤aj<p and n∈custom-character. When n∈custom-character+∪{0} the sum in 1 is called a p-adic integer. Equivalently, observe that any rational x/y can be rewritten in the form:








x
y

=



x



y





p
v



,



where



gcd

(


x


,

p

)


=


gc


d

(


y


,

p

)


=
1






The number v is called the p-adic valuation of x/y. In case v≥0, x/y is a p-adic integer. The ring of p-adic integers is denoted by custom-characterp.


An r-segment p-adic representation, a.k.a. Hensel code, simply truncates the above sum after j=r−1. In this case, the power series in eq. (1) becomes:










j
=
n


r
-
1




a
j



p
j



+

O

(

p
r

)





A natural consequence of this truncated representation is a mapping (discussed in detail in Definition 3) from a set of rationals to custom-character/prcustom-character. This mapping is the main component of our encoding scheme.


A specific set of rational numbers (p-adic numbers) called the Farey rationals are defined as follows.


Definition 1 (Farey Rationals): Given a prime p and an integer r≥1, let






N
=







p
r

-
1

2




.





The Farey rationals are defined as:











N

=

{




x
y

:
0





"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"



N

,


1

y

N


}


,




Eq
.

2







where gcd(x, y)=gcd(y, p)=1. (gcd is greatest common denominator)


We note that every rational in custom-characterN has p-adic valuation v≥0, and therefore custom-characterNcustom-characterp; i.e. every Farey rational is a p-adic integer.


For describing the mapping on which our encoder is based, we need to introduce the Modified Extended Euclidean algorithm MEEA. The MEEA is simply a truncated version of the extended Euclidean algorithm (EEA) and is similarly efficient. We pause briefly to describe the EEA. Recall that the EEA calculates the greatest common divisor of two integers x0, x1 along with the associated Bézout coefficients y, z∈custom-character such that x0·y+x1 z=gcd(x0, x1). The computation generates the tuples (x2, . . . , xn), (y2, . . . , yn), (z2, . . . , zn), and qi=└xi−1/xi┘ such that:











x

i
+
1


=


x

i
-
1


-


q
i



x
i




,





where







x
0


,


x
1



are


the


input

,








y

i
+
1


=


y

i
-
1


-


q
i



y
i




,






with



y
0


=
0

,


y
1

=
1

,








z

i
+
1


=


z

i
-
1


-


q
i



z
i




,






with



y
0


=
0

,


z
1

=
0.








Moreover, for each i≤ n, we have yix1+zix0=xi. The computation stops with xn=0, at which point xn−1=gcd(x0, x1).


Definition 2 (MEEA): Given x0, x1custom-character, MEEA(x0, x1) is defined as the output (x, y)=((−1)i+1xi, (−1)i+1yi) of the extended Euclidean algorithm (as described above) once |xi|≤N.


Now we are ready to define the necessary mapping from custom-characterN to custom-characterpr.


Definition 3: The mapping Hpr: custom-characterNcustom-characterpr and its inverse are defined as:












H

p
r


(

x
y

)

=

x


y

-
1



mod



p
r



,




Eq
.

3














H

p
r


-
1


(
h
)

=


MEEA

(


p
r

,

h

)

.





Eq
.

4







The H-mapping is injective and, therefore, gives a unique representation of each element of custom-characterN in custom-characterpr. The inverse of Hpr is well-defined.


Proposition 1. For all x/y∈custom-characterN and h∈Hpr(custom-characterN)⊆custom-characterpr,









(
i
)







H

p
r


-
1




(


H

p
r


(

x
/
y

)

)


=

x
/
y


,






(
ii
)







H

p
r




(


H

p
r


-
1




(
h
)


)


=
h

,






(
iii
)






If


a

,



a







and



a




=

a

(

mod



p
r


)


,



then



H

p
r


-
1




(
a
)


=


H

p
r


-
1





(

a


)

.










Proof. Let x/y∈custom-characterN, Hpr(x/y)=h, and suppose Hpr−1(h)=a/b. By definition of the MEEA and Hpr−1, there is an integer c such that bh+cpr=a. But then b(xy−1)≡a (mod pr), which implies xy−1≡ab−1 (mod pr). That is, Hpr(a/b)=Hpr(x/y). That a/b=xy then follows from injectivity of Hpr.

    • (ii) Let∈Hpr(custom-characterN)custom-charactercustom-characterpr, and suppose Hpr−1(h)=x/y. By definition of the MEEA, there is an integer z such that yh+zpr=x. Clearly xy−1≡h (mod pr), proving the result.
    • (iii) Let h′=h+kpr, the MEEA(pr, h′) generates tuples (x′0, x′1, x′2, x′3, . . . )=(pr, h′, pr, h, . . . ) and (y′0, y′1, y′2, y′3, . . . )=(0, 1, 0, 1, . . . ). Whereas running MEEA with pr and h generates tuples (x0, x1, . . . )=(pr, h, . . . ) and (y0, y1, . . . )=(0, 1, . . . ). Notice that x′2=x0 and y′2=y0. An easy induction shows that x′i=xi−2 and y′i=yi−2, for i=2, 3, . . . , whence MEEA(pr, h′)=MEEA(pr, h). This completes the proof.


Proposition 2. The mappings Hpr and Hpr−1 are homomorphic with respect to addition and multiplication in the following sense.










For


all


u

,


u




N


,




H

p
r


(
u
)

·


H

p
r


(

u


)


=





H

p
r


(

u
·

u



)


mod


p
r



and




H

p
r


(
u
)


+


H

p
r


(

u


)


=



H

p
r


(

u
+

u



)


mod



p
r

.








(
i
)













If


h

,


h







p
r




and





H

p
r


-
1


(
h
)

·


H

p
r


-
1


(

h


)




,




H

p
r


-
1


(
h
)

+






H

p
r


-
1


(

h


)



N


,



then




H

p
r


-
1


(

h
·

h



)


=





H

p
r


-
1


(
h
)

·


H

p
r


-
1


(

h


)




and




H

p
r


-
1


(

h
+

h



)


=



H

p
r


-
1


(
h
)

+


H

p
r


-
1


(

h


)











(
ii
)







Proof. (i) Let a/b, c/d∈custom-characterN. By definition of the Farey rationals, a, b, c, d are co-prime with p. That Hpr is homomorphic with respect to addition and multiplication follows from the properties of congruences:








ac

(
bd
)


-
1


=



(

ab

-
1


)



(

cd

-
1


)


mod


p
r



and



(

ad
+
bc

)




(
bd
)


-
1



=


(


ab

-
1


+

cd

-
1



)


mod


p
r









    • (ii) Invoking the homomorphic property of Hpr, from Hpr−1(h)·Hpr−1(h′), Hpr−1(h)+Hpr−1(h′)∈custom-characterN we obtain h·h′, h+h′∈Hpr(custom-characterN). By proposition 1(ii), Hpr(Hpr−1(h·h′))=h·h′ and Hpr (Hpr−1(h+h′))=h+h′. The result follows from the injectivity of Hpr.





Example 1. Given rationals a=12.37 and b=8.3, we choose p=3, r=10. Here N=└√{square root over ((pr−1)/2)}┘=125261. We compute the encodings of a and b as h1 and h2:







h
1

=



H

p
r


(

1237
100

)

=
2196674185








h
2

=



H

p
r


(

83
10

)

=
9414317891





We can now compose the rationals with addition, subtraction, and multiplication, and decode to check correctness:








r
1

=



h
1

+


h
2


mod


p
r



=
11610992076


,



H

p
r


-
1


(

r
1

)

=


2067
100

=
20.67










r
2

=



h
1

-


h
2


mod


p
r



=
24163415903


,



H

p
r


-
1


(

r
2

)

=


407
100

=
4.07










r
3

=



h
1



h
2


mod


p
r


=
2541865931


,



H

p
r


-
1


(

r
3

)

=


102671
1000

=
102.671






CHOICE OF p AND r. At this point it is clear that the H-mapping (in definition 3) can be used to map a set of Farey rationals into custom-characterpr. Thus, it can be used for encoding rational data that are contained in the set of Farey rationals which is the domain of the mapping. A natural question is: given a set of rationals how to choose pr (and, therefore, N) so that custom-characterN contains the rationals one wishes to encode? We point out that for a finite set of rationals S, one can choose pr≥maxa,b:a/b∈S(2a2+1, 2b2+1). Choosing a small p and a very large r is possible, though this could restrict the number of rationals that can be mapped due to the god condition (in definition 1). We illustrate this with examples in Supplemental A below.


Replacing the prime power with a composite. The above results can be extended when pr is replaced by an arbitrary positive integer g. Let p1, . . . , pk be distinct primes, g=p1r1 . . . pkrk, and N=└√{square root over ((g−1)/2)}┘. The Farey rationals defined by g are simply the set of reduced fractions:







N

=

{



x
y



0




"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"



N


,

1

y

N

,


gcd

(

y
,
g

)

=
1

,


gcd

(

x
,
y

)

=
1


}





We briefly recall (the integer version of) the Chinese Remainder Theorem (CRT), as it is necessary for our encoding scheme.


Definition 4 (Chinese Remainder Theorem). Let n1, . . . , nk be k co-prime integers, and n=Πi=1kni. The CRT describes the isomorphism custom-character/ncustom-charactercustom-character/n1custom-character× . . . ×custom-character/nkcustom-character given by:






x


(


x

mod


n
1


,


,

x

mod


n
k



)





We denote the x such that x=hi mod ni and (h1, . . . , hk)∈(h1, . . . , hk)∈custom-character/n1custom-character× . . . ×custom-character/nkcustom-character by CRTn, . . . , nk (h1, . . . , hk).


Remark 1. In the following definition, we abuse notation slightly and identify CRT . . . ( . . . ) not with actual ring elements in custom-character/ncustom-character, but with integer representatives in custom-charactern.


Definition 5. The injective mapping Hg:custom-characterNcustom-characterg and its inverse are defined as:











H
g

(

x
/
y

)

=


CRT


p
1

r
1


,
...
,

p
k

r
k




(



H

p
1

r
1



(

x
/
y

)

,


,


H

p
k

r
k



(

x
/
y

)


)





Equ
.

5














H
g

-
1


(
h
)

=

MEEA

(

g
,
h

)





Equ
.

6







The following proposition is an extension of proposition 1 for composite g and its proof proceeds similar to the proof of proposition 1.


Proposition 3. Let N=└√{square root over ((g−1)/2)}┘. For all x/y∈custom-characterN and h∈Hg(custom-characterN)custom-charactercustom-characterg,












H
g

-
1


(


H
g

(

x
/
y

)

)

=

x
/
y


,
and




(
i
)














H
g

(


H
g

-
1


(
h
)

)

=

h
.





(
ii
)













If


h

,



h







and



h




=

h

(

mod

g

)


,


then




H
g

-
1


(
h
)


=



H
g

-
1


(

h


)

.






(
iii
)







Proposition 4. The mapping Hg is homomorphic with respect to addition and multiplication, and Hg−1 is homomorphic as in proposition 2.


Proof. Let N=└√{square root over ((g−1)/2)}┘, and u, u′∈custom-characterN. Using the homomorphic properties of the CRT where necessary, we have:









H
g

(

u
+

u



)

=


CRT


p
1

r
1


,
...
,

p
k

r
k




(



H

p
1

r
1



(

u
+

u



)

,


,


H

p
k

r
k



(

u
+

u



)


)


,





and








H
g

(
u
)

+


H
g

(

u


)


=


CRT


p
1

r
1


,
...
,

p
k

r
k




(




H

p
1

r
1



(
u
)

+


H

p
1

r
1



(

u


)


,


,



H

p
k

r
k



(
u
)

+


H

p
k

r
k



(

u


)



)





By proposition 2(i), each









H

p
i

r
i



(
u
)

+


H

p
i

r
i



(

u


)


=



H

p
i

r
i



(

u
+

u



)


mod



p
i

r
i


.






Whence Hg(u+u′)=Hg(u)+Hg(u′). The proof that Hg(u·u′)=Hg(u)·Hg(u′) is analogous.


To establish the homomorphic properties of Hg−1 simply replace pr by g everywhere in the proof of proposition 2(ii).


Example 2. Suppose we have the same rationals of Example 1: a=12.37 and b=8.3. We now choose p=6, r=17 and g=p+1=16926659444737, which yields N=└√{square root over ((g−1)/2)}┘=2909180. The encodings of a and b are:







h
1

=



H
g

(

1237
100

)

=
16757392850302








h
2

=



H
g

(

83
10

)

=
1692665944482





Again, we compose the encodings, and verify the correctness of the results:








r
1

=



h
1

+


h
2


mod

g


=
1523399350047


,



H
g

-
1


(

r
1

)

=


2067
100

=
20.67










r
2

=



h
1

-


h
2


mod

g


=
15064726905820


,



H
g

-
1


(

r
2

)

=


407
100

=
4.07










r
3

=



h
1



h
2


mod

g

=
7058416988558


,



H
g

-
1


(

r
3

)

=


102671
1000

=
102.671






Remark 2. Definitions 3 and 5 coincide when g=pr (a prime power), so one should take the latter as the general definition of H and H−1, picking g to be a prime power when necessary.


Size of the set. The cardinality of custom-characterN for N=└√{square root over ((g−1)/2)}┘ depends heavily on the choice of g. This is because the number of fractions x/y with |x|, |y|≤N that fail the condition gcd(y, g)=1 depends on the prime factorization of g—the more “small” prime factors g has, the more fractions fail the god condition.


Proposition 5. The cardinality of custom-characterN for N=└√{square root over ((g−1)/2)}┘ is given by:








4
·

Φ

(
N
)


+
1
-

(


#


of


x
/
y


with



gcd

(

y
,
g

)



1

)


,




where Φ(k)=Σi−1kϕ(i) and ϕ is the Euler's totient function.


Proof. Use the fact that the kth Farey sequence (the kth Farey sequence is the set of reduced fractions in the interval [0, 1) with numerator and denominator each at most k) has length 1+Φ(k), and then enforce the god condition on the Farey rationals.


Simulations show that when g is an odd prime,












"\[LeftBracketingBar]"


N



"\[RightBracketingBar]"


=



4
·

Φ

(
N
)


+
1



0.6

g
.







Eq
.

7







This fact will be used for comparison with existing work in section 5.2 below.


3 PIE: A Rational Encoder

Let g be a positive integer, N=└√{square root over ((g−1)/2)}┘, and make custom-characterN the input space. We define encoding and decoding as follows:



















PIE.Encode(x/y). For x/y ∈ FN output Hg(x/y)




PIE.Decode(z). For z ∈  custom-characterg, output Hg−1 (z)










Proposition 6. For all m, m′∈custom-characterN such that m·m′∈custom-characterN,
















 PIE.Decode([PIE.Encode(m) · PIE.Encode(m′) mod g]) = m · m′



and ∀m, m′ ∈  custom-characterN such that m + m′ ∈  custom-characterN



 PIE.Decode([PIE.Encode(m) + PIE.Encode(m′) mod g]) = m + m′









Proof. Use proposition 3(i), proposition 3(iii), and proposition 4.


Corollary 1. Let p be a multivariate polynomial with coefficients in custom-character. For all m0, . . . , mkcustom-characterN such that p(m0, . . . , mk)∈custom-characterN,
















PIE.Decode(g, p(PIE.Encode(g, m0), . . . , PIE.Encode(g, mk)) mod g)



 = p(m0, . . . , mk).









As indicated in the preceding results, for the encoding (and decoding) to yield the correct result when used in an HE scheme, one must ensure that if two or more elements from custom-characterN are combined using additions and/or multiplications then any intermediates and the final output must not lie outside the set custom-characterN. For this reason, we will define the (rational) message space to be the following subset of custom-characterN:










M

=

{



x
/
y





N

:

0





"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"



M


,

1

y

M


}





Eq
.

8







The main idea behind choosing a subset of custom-characterN as the set of messages is that when elements from custom-characterM are combined, the resulting element can be in custom-characterN. Ensuring the output lands in custom-characterN induces a bound on the number of computations that can be performed, and determines the choice of parameters involved therein. At this point, one might wonder whether we need to do something similar with the range custom-characterg of the encoder to make sure that overflow modulo g does not occur during computations. The answer is “no”. This is because proposition 3(iii) along with the above message space restriction imply that overflow modulo g does not affect decoding.


The choice of M depends jointly on the rational data one must encode, and the circuits one must evaluate over those data. We elaborate this in the following section.


3.1 Choosing the Message Space custom-characterM.


We will describe an arithmetic circuit in terms of the multivariate polynomial it computes. To this end, recall that the custom-character1-norm of a polynomial is simply the sum of the absolute values of its coefficients.


Polynomials with which PIE is compatible. Let custom-characterd,t denote the set of polynomials in custom-character[x1, x2, . . . ] with total degree at most d and custom-character1-norm at most t, whose coefficients have absolute value at least 1. For example, custom-characterd,t contains polynomials of the form:








p

(


x
1

,


,

x
k


)

=








d
1

+

...

+

d
k



d






α
=
1

I




c
α



x
1

d
1




x
1

d
2








x
k

d
k






,




where each |cα≥1, and Σα|cα|≤t.


The following proposition establishes an upper bound on the output of a polynomial in custom-characterd,t when all inputs are from custom-characterM.


Proposition 7. If x1/y1, . . . , xk/ykcustom-characterM, p∈custom-characterd,t is k-variate, and p(x1/y1, . . . , xk/yk)=x/y, then:









"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"





t
·

M
dt




and





"\[LeftBracketingBar]"

y


"\[RightBracketingBar]"





M
dt





Proof. Note that custom-characterd,t can be written as, p=Σicipi, where Σi|ci|≤t, each |c|≥1, and each pi is a monomial of degree at most d.







Let


p

=







i
=
1

I



c
i




p
i

.






Since deg(pi)≤d, the evaluation pi(x1/y1, . . . , xk/yk) is a fraction of the form:









a
i


b
i


=



x

i
1




x

i
2








x

i






y

i
1




y


i
2









y

i






,



for


some










d


and



{


i
1

,


,

i



}






{

1
,


,
k

}

.






As each xi/y1custom-characterM, we have |ai|, |bi|≤custom-character≤Md.


Since x/y=Σi=11ci·ai/bi, there are nonzero integers α and β such that:







α

x

=




(


c
1



a
1


)



b
2



b

3








b
I


+



b
1

(


c
2



a
2


)



b

3








b
I


+


b
1



b
2








b

I
-
1


(


c
I



a
I


)



and


β

y


=


b
1



b
2








b
I

.







It follows from Σ|ci|≤t and the above bound on |ai|, |bi| that:









"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"







i
=
1

1





"\[LeftBracketingBar]"


c
i



"\[RightBracketingBar]"





(

M
d

)

I






t
·

M
dI




and





"\[LeftBracketingBar]"

y


"\[RightBracketingBar]"






M
dI

.





The proof is completed by observing that |ci|≥1, for all i, implies I≤t.


Proposition 8. A sufficient condition for compatibility of PIE with polynomials in custom-characterd,t as in Corollary 1:












PIE
.

Decode
(

g
,


p

(


PIE
.

Encode
(

g
,

m
0


)


,


,

PIE



Encode
(

g
,

m
k


)



)


mod


g



)



=

pm
0


,


,

m
k


)




Eq
.

9








is






M



(

N
t

)


1

d

t




,


equivalently


d






log

(
N
)

-

log

(
t
)



t



log

(
M
)



.






Proof. Suppose M is chosen according to eq. (9), and let p∈custom-characterd,t be k-variate. According to proposition 7, if m≠custom-characterMk and p(m)=x/y, then:














"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"




t
·

M
dt




t
·


(


(

N
/
t

)


1

d

t



)

dt



=
N

,
and




Eq
.

10
















"\[LeftBracketingBar]"

y


"\[RightBracketingBar]"




M
dt



(


(

N
/
t

)


1

d

t



)


=


N
/
t



N
.






Eq
.

11







Clearly gcd(g, y)=1, since y is a factor of the product of the denominators in m. Thus p(m)∈custom-characterN, and the proof is completed.


4 PIE with a Batch FHE over Integers


Batch FHE. Let λ be the security parameter, γ and η be the bit-length of the public and secret key respectively, and ρ be the bit-length of noise. Further, choose custom-character-bit integers custom-character1, . . . , custom-character. The IDGHV scheme is defined as follows.


IDGHV.KGen(1λ, custom-character. Choose distinct η-bit primes p1, . . . , custom-character, and let π be their product. Choose a uniform 2λ2-rough integer q0<2γ/π, and let the public key be x0=q0·π (An integer is b-rough provided it has no prime factors smaller than b). It is required that gcd(Πjcustom-characterj, x0)=1. Choose integers xi, and x′i with a quotient by π uniformly and independently distributed in custom-character∩[0, q0), and with the distribution of modulo pj for 1≤j≤custom-character as follows:










1

i

τ

,



x
i


mod



p
j


=


j


r

i
,
j




,





r

i
,
j









(


-

2
ρ


,

2
ρ


)









1

i



,



x
i



mod



p
j


=



j


r

i
,
j




+

δ

i
,
j




,





r

i
,
j





ℤ∩

(


-

2
ρ


,

2
ρ


)








Let pk={x0, custom-character, (xi)1≤i≤τ, custom-character} and sk=custom-character.


IDGHV.End(pk,m). For m=(m1, . . . , custom-character)∈custom-character/custom-character× . . . ×custom-character/custom-character, choose a random binary vector b=(b1, . . . , bτ) and output the ciphertext:






c
=


(





i
=
1





m
i

·

x
i




+




i
=
1

τ



b
i

·

x
i




)



(

mod



x
0


)


















IDGHV.Dec(sk,c). m = (m1, . . . ,  custom-character  ) where mj ← c mod pj (mod Qj)


IDGHV.Add(pk, c1, c2). Output c1 + c2 mod x0


IDGHV.Mult(pk, c1, c2). Output c1 · c2 mod x0









The security of the IDGHV scheme is based on the decisional approximate GCD problem (DACD).


4.1 PIE with IDGHV.


Permitted Circuits and Parameters for IDGHV.

Definition 6. Let C be an arithmetic circuit and ρ′=max{ρ+log(custom-character)+custom-character, 2ρ+log(τ)}. C is a permitted circuit if every input being bounded in absolute value by custom-character implies the output is bounded in absolute value by 2η−4.


Describing circuits in terms of the multivariate polynomial they compute yields a sufficient condition for determining whether a given circuit is permitted.


Lemma 1. Let C be an arithmetic circuit over the rationals comprised of addition/subtraction and multiplication gates, f be the multivariate polynomial that C computes, and |f|1 be the custom-character1 norm of f. If








deg

(
f
)

<


η
-
4
-

log

(




"\[LeftBracketingBar]"

f


"\[RightBracketingBar]"


1

)




ρ


+


Q




,




then C is a permitted circuit.


One can show that for a circuit with multiplicative depth D, the total degree of the polynomial f computed by the circuit is at most 2D−1+1≈2D−1. Further, we note that maximum value of deg(f) is (roughly) inversely proportional to |custom-character|bits=custom-character, so the multiplicative depth of permitted circuits decreases as the bit size of the custom-character increases.


We assume here that log(|f|1)«η, ρ′, so it suffices to choose custom-character such that μ/(ρ′+custom-character) is not too small. To this end, suppose we want to support circuits computing a polynomial of degree at most δ. Then we choose custom-character<2+, custom-character=O(ρ), and η≥ρ′Θ(δ). In particular, we recommend:










2
ρ


,


ρ

,



and


η

=

3


ρ




δ
.







PARAMETERS FOR PIE WITH IDGHV. The maximum depth of circuits with which PIE is compatible depends on the size of the message space custom-characterM relative to the size of the input space custom-characterN (i.e., how small M is relative to N). This means that fixing M determines the circuits one can evaluate, and fixing the circuits to be evaluated determines M. We give an analytical discussion of the two cases below.


First, we pause to remind the reader of the relevant parameter sizes for IDGHV.


For ciphertexts of the form c=custom-character(q, custom-character1r1+m1, . . . , custom-character+custom-character), we have |pi|bits=η, |custom-character|bits=custom-character, and ρ′=max{ρ+log(custom-character)+custom-character, 2ρ+log(τ)}.


In the following discussion, g=custom-character, N=└√{square root over ((g−1)/2)}┘, and custom-characterM is the message space, where M≤N.


Choosing circuits first. Given a set of circuits, we must choose d and t so that custom-characterd,t contains the polynomials which the circuits in the set compute. To this end, choose d, t to satisfy lemma 1. That is,






d
<



η
-
4
-

log

(
t
)




ρ


+


Q



.





We put t=1 for convenience and to maximize the multiplicative depth of permitted circuits, whence the permitted circuits are given by custom-characterd,1 for d≈(η−4)/(ρ′+custom-character)−1. Rewriting eq. (9) to get a bound on |M|bits and using the above values of d, t we obtain:













"\[LeftBracketingBar]"

M


"\[RightBracketingBar]"



b

i

t

s








ℓℓ
Q



ρ



+


Q
2



2


(

η
-

ρ


-


Q

-
4

)



.





Eq
.

12







Note that t may be chosen much larger, though too large a value may force M to be unreasonably small in order to satisfy eq. (9).


Choosing messages first. M must satisfy eq. (9). Thus, circuits which compute polynomials in custom-characterd,t are permitted as long as









log

(
t
)


log

(
M
)


+

d

t






log

(
N
)


log

(
M
)


.





This inequality is satisfied by choosing:






t
<

M


and


d






log

(
N
)

-

log

(
M
)



M


log

(
M
)



.





Thus, we may choose:






t
=


M
-

1


and


d







ℓℓ
Q

-

2


log

(
M
)




2

M


log

(
M
)



.






Note that this will require the values of custom-character and custom-character to be quite large. E.g., M log(M)≤custom-character


Two Encoding Options. There are two ways to combine PIE with IDGHV: using the Chinese Remainder Theorem, and component-wise. The former encodes single rationals, while the latter encodes vectors of rationals. Depending on the application a user can choose one of these two. We elaborate them below.


ENCODING WITH THE CHINESE REMAINDER THEOREM CHOOSE the public parameter custom-character1, . . . , custom-character to be distinct odd primes. Let g=custom-character, N=└√{square root over ((g−1)/2)}┘, and M«N.


We use the Chinese Remainder Theorem (CRT) to convert the integer output of PIE.Encode to a vector of integers which is the input to IDGHV. We encode and decode with IDGHV as the underlying encryption scheme as follows:
















IDGHV.Encode. For m ∈  custom-characterM, output



(PIE.Encode(m) mod  custom-character1, . . . , PIE.Encode(m) mod  custom-character  )



IDGHV.Decode. For (h1, . . . ,  custom-character  ) ∈  custom-character  /Q1custom-character   × . . . ×  custom-character  / custom-charactercustom-character  ,



compute



h =  custom-character  (h1, . . . ,  custom-character  ), then output PIE.Decode(h).









Encoding and decoding above are computed with Hg and its inverse.


Choosing M for CRT Encoding. M must be chosen according to eq. (12). That is,










"\[LeftBracketingBar]"


M
i



"\[RightBracketingBar]"



b

i

t

s







ℓℓ
𝒬



ρ



+


𝒬
2



2


(

η
-

ρ


-


𝒬

-
4

)







ENCODING COMPONENT-WISE. Choose the public parameters custom-character1, . . . , custom-character to be not-necessarily-distinct primes, and put. Using eq. (9), we obtain Mi≤(Ni/t)1/dt, where d, t are chosen according to lemma 1. The encoding is as follows:














IDGHV.Encode. For (m1, . . . ,  custom-character  ) ∈  custom-characterM1 × . . . ×  custom-character  ,


output (PIE.Encode(m1), . . . , PIE.Encode( custom-character  ))


IDGHV.Decode. For (h1, . . . ,  custom-character  ) ∈  custom-character  / custom-character1custom-character   × . . . ×  custom-character  / custom-charactercustom-character  ,


output (PIE.Decode(h1), . . . , PIE.Decode( custom-character  ))









In the component-wise encoding, for each i, PIE.Encode(hi) and PIE.Decode(hi) are computed with custom-character as the modulus, i.e., the encoding and decoding functions are HQi; and the corresponding inverses.


Choosing the Mi for Component-wise Encoding. Since we are encoding with primes custom-characteri instead of their product, it suffices here to make a minor change to eq. (12). Namely, we put custom-character=1. This yields:










"\[LeftBracketingBar]"


M
i



"\[RightBracketingBar]"



b

i

t

s








𝒬



ρ



+


𝒬
2



2


(

η
-

ρ


-


𝒬

-
4

)







4.2 IDGHV-Compatible Encoding Parameters and Message Space.









TABLE 1







Size of the elements of the rational message space


custom-characterM along with maximum degree d of compatible


polynomials. Parameters chosen according to


the recommendations in Section 3.2.


Parameters for (the CRT version of) PIE + IDGHV














λ

custom-character


custom-characterQ

max d
|M|bits
γ
η
ρ

















50
6
60
15
10
≈5.3 · 108
4248
100


60
8
80
19
13
≈1.3 · 109
6402
120


70
10
100
18
23
  ≈3 · 109
9041
140









Remark 3. |M|bits=23 simply means that the message space is comprised by fractions whose numerators and denominators are up to 23 bits. Note that the co-primality restriction will not apply if M is smaller than every prime factor of g=πcustom-characteri.


Choosing the custom-characteri appropriately. We emphasize that PIE may be attached to IDGHV regardless of the choice of the custom-characteri. However, the input space custom-characterN (of PIE) may be too small to be useful if the number and size of the custom-characteri are too small. In contrast, note that the custom-characteri can be small as long as there are “enough” of them. Similarly, if the number of custom-characteri is small, then their product should be quite large. As an example of the former, if custom-characteri=3 for i=1, . . . , 5, then the message space of IDGHV is (isomorphic to) custom-character/35custom-character. The encoding modulus for PIE is 35=243 which is co-prime with 10, so we can encode certain decimal numbers up to precision 2 such as 1.37=137/100.


We can use parameters to determine the size of each element in the corresponding message space by coupling PIE with IDGHV. Let custom-character1, . . . , custom-character be distinct primes—public key elements in IDGHV. For encoding a single message, we take the product of all custom-characteri''s as g and encode the rational message using g. Four different configurations are provided: Toy, Small, Medium, and Large. In the Medium configuration, we have 138 56-bit custom-characteri's. This gives us a g of roughly 7728 bits with an N of roughly 3864 bits. In the Large configuration, we have 531 71-bit custom-characteri's. This gives us a g of length roughly 37701 bits with an N of roughly 18850 bits.


A large N resulting from (secure) HE parameters, is very advantageous. For example, if we take N≈218850 and M=264−1 (that allows fractions with numerators and denominators of up to 64 bits to be encoded), then we can use eq. (9) to find sets of polynomials custom-characterd,t with which PIE is compatible. In this case, we get compatibility with polynomials in custom-character24,24 (total degree and custom-character1-norm at most 24) or with polynomials in custom-character10,29 (total degree at most 10 and custom-character1-norm at most 29). These sets of polynomials correspond to arithmetic circuits of (approximate) multiplicative depth 4 and 3, respectively. Of course, if one chooses a smaller M, then the multiplicative depth of compatible circuits increases.


5 PIE with Modified Fan-Vercauteren HE


The modified FV scheme. We give a brief description of a modification of the FV


HE scheme that is based on the decisional Ring Learning With Errors (RLWE) problem. The main difference between the modified FV (ModFV) and FV is that the former encrypts integers while the latter encrypts polynomials. In particular, ModFV is obtained from FV by attaching the Hat Encoder. We recall the encoder here.


Definition 7 (Hat Encoder). Let ∥·∥denote the polynomial infinity norm. For m∈custom-character/(bn+1)custom-character, b≥2 and n≥1, let {circumflex over (m)} be the polynomial with lowest degree such that ∥{circumflex over (m)}∥≤(b+1)/2 and m(b)=m mod bn+1. Such a polynomial always exists and has degree at most n−1.


Roughly speaking, the Hat encoder takes the base-b expansion of m with coefficients in Zbn+1, and then replaces everywhere b by an unknown x to obtain the polynomial {circumflex over (m)}(x).


We are now ready to define ModFV. For n a power of 2 (typically at least 1024), denote the 2nth cyclotomic ring of integers by R=custom-character[x]/(xn+1), and let Ra denote the ring obtained by reducing the coefficients of R modulo a. The plaintext space is the ring custom-character=custom-characterbn+1, for b≥2, and the ciphertext space is product ring Rq×Rq for q»b. Let λ be the security parameter and x be a discrete Gaussian distribution with standard deviation σ (typically σ=3.19).














ModFV.SecretKeyGen. Sample s ∈ R with coefficients uniform in


{−1, 0, 1}.


Output sk = s.


ModFV.PublicKeyGen(sk). Let s = sk. Sample a ← Rq, and e ← x.


Output pk = ([−(as + e)]q, a) ∈ Rq × Rq.


ModFV.EvalKeyGen(sk). For i = 0, . . . ,  custom-character  , where w ≥ 2 and


custom-character   = └logwq┘,


sample ai ← Rq, and ei ← x. Put evk[i] = ([−(ais + ei) + wis2]q, ai) ∈


Rq × Rq.


Output the vector of pairs evk = (evk[0], . . . , evk[ custom-character  ]).


ModFV.Enc(pk, m ∈  custom-character  ).











Let



Δ
b


=




-

q


b
n

+
1





(


x

n
-
1


+

b


x

n
-
2



+

+

b

n
-
1



)














and pk = (p0, p1). Sample u ∈ R with coefficients uniform in


{−1, 0, 1}, and e0, e1 ← x. Let {circumflex over (m)} be a hat encoding of m.


Output ct = ([Δb {circumflex over (m)} + p0u + e0]q, [p1u + e1]q) ∈ Rq × Rq.


ModFV.Dec(sk, ct ∈ Rq × Rq). Let s = sk and ct = (c0, c1).










Let



M
^


=







x
-
b

q

[


c
0

+


c
1


s


]

q



.










Output m′ = {circumflex over (M)}(b) ∈  custom-character  .










5.1 PIE with ModFV


We stress that although CLPX uses a function having the same definition as our “H-function”, their approach is not based on techniques from p-adic number theory. Consequently, the decode functions and input spaces differ dramatically between CLPX and PIE. A comparison of the input spaces is provided in section 5.2.


In pairing PIE with ModFV, we distinguish two cases: b″ +1 prime and b″ +1 composite. We note, however, that the definitions of encoding and decoding are identical for both cases. The differences lie in how b and n are chosen, and the resulting input spaces.


Put N=└√{square root over (((bn+1)−1)/2)}┘=└√{square root over (bn/2)}┘ and let custom-characterM be as in Eq. (8).


That is, custom-characterM is the set of reduced fractions x/y satisfying: |x|≤M, 1≤|y|≤M, and gcd(bn+1, y)=1. M is chosen to be much smaller than N according to eq. (9) and eq. (14). We define encoding as follows:



















ModFV.Encode. For x/y ∈  custom-characterM ⊆  custom-characterN,




output h = PIE.Encode (x/y) ∈  custom-character  /(bn + 1) custom-character  .




ModFV.Decode. For h ∈  custom-character  /(bn + 1) custom-character  ,




output x/y = PIE.Decode (h) ∈  custom-characterN.










bn+1 prime. Note that since bn+1 is prime, the function Hbn+1 maps x/y to xy−1 mod bn+1 (definition 5). Further, since gcd(y, bn+1)=1 for all 0<y≤ N, no fractions are discarded because of the gcd condition in definition 1—i.e., all x/y with |x|, |y|≤N can be encoded.


Choosing b and n for bn+1 a prime. As one might suspect, there are rather few choices for b and n which make bn+1 prime. The known Fermat primes (primes of the form 22n+1) are too small for the parameter requirements of ModFV. In our search for suitable primes, we found OEIS (On-Line Encyclopedia of Integer Sequences) sequence A056993 which lists primes of the form k2+1. While this sequence does not provide many candidates, this is not a problem since b and n are public parameters. In particular, one can reuse an appropriately-chosen prime bn+1 as needed without compromising security.


bn+1 composite. For a composite bn+1, the mapping Hbn+1 is defined by the CRT, which requires (non-trivial) co-prime factors of bn+1 to be known. This could be problematic, as n≥1024 will make bn+1 very large even for small b. The following lemma addresses this difficulty.


Proposition 9. If g is a positive integer and x/y∈custom-characterN, then Hg(x/y)=xy−1 mod g.


Proof. This is immediate if g is prime, so suppose g is composite with prime factorization







g
=



p
1

r
1









p
k

r
k


.

Let



x
/
y



N



,


h
i

=


H

p
i

r
i



(

x
/
y

)


,




and h=Hg(x/y). By definition 5,






h
=



CRT


p
1

r
1


,


,

p
k

r
k




(


h
1

,


,

h
k


)

.





By the definition of the CRT, h is the unique integer in custom-characterg such that h=hi mod pir1. Put h′=xy−1 mod g, so yh′=x mod g. Since each pir1 divides g, yh′=x mod pir1. Multiply both sides of the preceding equation by the inverse of y modulo pir1 to get h′=xy−1 mod pir1. But this means that h′=hi mod pir1, whence h′=h. This completes the proof.


As noted above, bn+1 may be large enough to make factoring infeasible. In this case, determining the entire input space is also infeasible, because one must enforce the condition: gcd(y,bn+1)≠1→x/y∉custom-characterN. This is not a problem however, as we only need a suitable subset of custom-characterN; namely custom-characterM. We note that if y and b have the same prime factors, then gcd(y, bn+1)=1, whence we can encode x/y as long as every prime factor of y is a factor of b. For example, we may choose b=p1p2 . . . pk, the product of the first k primes for some k≥1, meaning we can encode all x/y∈custom-characterM such that any prime factor of y is one of p1, . . . , pk. This approach can certainly give us a sufficiently large set of fractions as the message space of PIE, though this set may not be the entirety of custom-characterM.


We further distinguish the case where b=p is prime, for this allows us to encode certain p-adic non-integers (p-adic numbers with negative valuation). In particular, since p and pn+1 are always co-prime, we can encode rationals of the form x/pk (k>0) that are contained in custom-characterN.


Compatible Circuits. The performance of ModFV is assessed by evaluating so-called regular (arithmetic) circuits. We directly apply the bounds from their analysis on such circuits to our encoder to FV. A regular circuit is parameterized by non-negative integers A, D, L, and consists of evaluating A levels of additions followed by one level of multiplication, iterated D times, where inputs are integers from [−L, L]. Note that such a circuit has multiplicative depth D. The output c of a regular circuit (satisfies:













"\[LeftBracketingBar]"

c


"\[RightBracketingBar]"




V

(

A
,
D
,
L

)


=


L

2

D





2

2


A

(


2
D

-
1

)



.






Eq
.

13







We define permitted circuits in essentially the same way as Section 4.1.


Definition 8. For fixed A, D, L, an arithmetic circuit Cis a (A, D, L)-permitted circuit if every input being bounded in absolute value by L implies the output is bounded in absolute value by V (A, D, L).


Eq. 13 implies every regular circuit parameterized by A, D, L is an (A, D, L)-permitted circuit. When the context is clear, we will omit “(A, D, L)” and simply write “permitted circuit”.


Lemma 2. Fix non-negative integers A, D, L. Let C be an arithmetic circuit, f be the multivariate polynomial that C computes, |f|1 be the custom-character norm of f, and V=V (A, D, L). If |f|1Ldeg(f)<V or equivalently,











deg


(
f
)


<


2

D

+



2


A

(


2
D

-
l

)


-

log

(




"\[LeftBracketingBar]"

f


"\[RightBracketingBar]"


1

)



log

(
L
)




,




Eq
.

14







then C is a permitted circuit.


Proof. Let C be an arithmetic circuit, and f be the k-variate polynomial which C computes. We can express f in the form Σi=11cifi, where the fi are monomials and the ci are the coefficients.


For x∈[−L, L]k and L=(L, L, . . . , L)∈{L}k, we use the triangle inequality and deg(fi)≤deg(f) to obtain:












"\[LeftBracketingBar]"


f

(
x
)



"\[RightBracketingBar]"


=





"\[LeftBracketingBar]"





i
=
1

I



c
i




f
i

(
x
)





"\[RightBracketingBar]"




|




i
=
1

I



c
i




f
i

(
L
)







"\[RightBracketingBar]"






"\[LeftBracketingBar]"





i
=
1

I



c
i



L

deg

(
f
)






"\[RightBracketingBar]"








"\[LeftBracketingBar]"

f


"\[RightBracketingBar]"


1



L

deg

(
f
)




,




The above inequalities yield |f(x)|≤ V, completing the proof.


To guarantee that PIE works seamlessly with ModFV, we must ensure that the maximum degree of polynomials compatible with ModFV does not exceed the maximum degree of polynomials compatible with PIE. Thus, according to lemma 2 and equation 9, we require:










log

(
V
)

-

log

(




"\[LeftBracketingBar]"

f


"\[RightBracketingBar]"


1

)



log

(
L
)


<



log

(
N
)

-

log

(
t
)



t


log

(
M
)




,




where f computes an (A, D, L)-permitted circuit, and custom-characterd,t is the set of polynomials with which PIE is compatible. In practice, this inequality is easily satisfied because log(N)/log(M) is quite large and t is chosen to be small.


5.2 PIE vs CLPX: Input Space Advantage.

CLPX adapts the polynomial encoding idea from previous works while addressing the problem of plaintext polynomial coefficient growth. As explained above, to obtain the maximum circuit depth (corresponding to homomorphic computation) for PIE with ModFV we can directly use their analysis. Table 2 shows that when used with PIE scheme, the multiplicative depths of circuits compatible with ModFV are almost the same as when used with CLPX encoding.









TABLE 2







Comparison of maximum circuit depth D with ModFV


and PIE + ModFV.















L = 28
L = 216
L = 232
L = 264



















log2

max

max

max

max



n
q
b
D
b
D
b
D
b
D










Number of additions A = 0

















214
435
257
14
257
13
257
12
257
11
[4]


215
890
216
16
216
15
232
15
232
14



214
435
216
11
216
11
232
11
232
11
Our work


215
890
216
15
216
14
232
14
232
13








Number of additions A = 3

















214
435
128
13
211
13
724
12
431
11
[4]


215
890
228
16
222
15
219
14
235
14



214
435
216
10
216
10
216
10
216
10
Our work


215
890
216
15
216
14
232
14
232
13









The definition of the CLPX input space custom-character depends on whether b>2 is even or odd. If b is odd, then bn+1 is even, which means no fractions with even denominators can be encoded, and, moreover, b″ +1 will not be prime. We consider the odd case to be too restrictive, and, therefore, only compare the input space of PIE with the input space of CLPX when b is even.


Proposition 10. For b even, the cardinality of the input space custom-character is









b
n

-
1


b
-
1


.




By proposition 5 and eq. (7), when bn+1 is prime, the cardinality of custom-characterN is approximately 0.6(bn+1). Consequently, using proposition 10, we see the cardinality of custom-characterN is roughly 0.6(b−1)-times (since bn is quite large,










n

𝒫




0.6

(


b
n

+
1

)



(

b
-
1

)




b
n

-
1




0.6

(

b
-
1

)



)




the size of custom-character. Thus, our input space is larger when b≥3, and our size advantage is directly proportional to the size of b, as shown in table 3.









TABLE 3





Comparison of input space sizes for PIE and CLPX when bn + 1 is prime.


The values of n are chosen according to the security recommendations


for FV.


















b
150
824
1534


n
211
210
212


PIE (| custom-characterN|)
0.6(150211 + 1)
0.6(824210 + 1)
0.6(1534212 + 1)





CLPX (| custom-character  |)






1

5


0

2

1

1




-
1


1

4

9











8

2


4

2

1

0




-
1


8

2

3











1534

2
12


-
1

1533













PIE

C

L

P

X





 86
600
 857
















TABLE 4





Comparison of input space sizes  custom-characterN (for PIE) and  custom-character   (for CLPX) when bn + 1 is composite.























b
3
5
7
6
30
30
210
210


n
12
8
8
16
4
8
4
6


PIE
442765
324646
4787969
≈1.7 × 1012
≈487992
  ≈4 × 1011
≈1.2 × 109
≈4.4 × 1013


CLPX
265720
97656
960800
≈5.6 × 1011
  27931
≈2.2 × 1010
  ≈9 × 106
≈4.1 × 1011









PIE

C

L

P

X





1.7
3.3
5
3
16.7
16.7
125
111.1









For bn+1 composite, our size advantage seems to remain, though it is less clear-cut than the prime case, since our examples use quite small b and n. In table 4, we estimate the size of custom-characterN by using proposition 5 and the approximation Φ(n)≈3n22. Note that, in practice, the size of b and n will be much larger than the numbers provided in the table, and we cannot speculate to how the relationship between |custom-characterN| and |custom-character| varies as b and n become large enough for practical applications.


6 Experimental Results

We implemented PIE (in C++) together with proof-of-concept implementations of IDGHV and ModFV schemes (the FHE part of our implementation is not optimized) using NTL.


Since our encoding does not affect the run time of the underlying HE scheme, we provide benchmark times taken for encoding and decoding only. We estimated the runtime of encoding and decoding using two sets, each containing 10,000 rational numbers. The first set contains rationals with numerator and denominator up to 32 bits and the second set contains rationals with numerator and denominator up to 64 bits. These sets are simply the message space custom-characterM={x/y||x|≤M, 0<y≤M} for M=232−1 and M=264−1, respectively. Runtimes are obtained as the average runtime over all the elements in each set. The results are shown in table 5. All experiments are done on a Mac-Book Pro with Apple M1 Max, 32 GB RAM, 1TB SSD.









TABLE 5







Average encoding and decoding times for various parameters.


Here p is the prime used for encoding and decoding.









|p|bits














650
650
1250
1250
3200
3200









|M|bits














32
64
32
64
32
64





Encode time
0.023833 ms
0.001958 ms
0.006584 ms
0.001708 ms
0.003916 ms
0.002375 ms


Decode time
0.047792 ms
0.054791 ms
0.028625 ms
 0.0475 ms
0.046625 ms
 0.06175 ms









Our implementation of encoding and decoding is not optimized for performance. We have used NTL for computing inverse in the encoding function. For the MEEA in decoding, we implemented the (truncated) extended Euclidean algorithm.


A Supplemental: Encodings with Primes and Prime Powers


Assume we want to encode the following fractions:











m
1

=


-
2

/
3


,


m
2

=


-
1

/
2


,


m
3

=

1
/
3.






Eq
.

15







Let p=11 and r=3, so pr=1331 and N=└√{square root over ((pr−1)/2)}┘=25. Since the above fractions lie in custom-character25, we can encode them as follows:










m
1

=


H
1331

(


-
2

/
3

)


)

=
443

,








m
2

=



H
1331

(


-
1

/
2

)

=
665


,







m
3

=



H
1331

(

1
/
3

)

=
444.





Due to the restriction gcd(denominator, pr)=1, many fractions x/y which satisfy |x|, |y|≤ N cannot be encoded. E.g., when pr=113, 23/22 cannot be encoded. Of course, this is because the mapping Hpr requires the inverse of the denominator modulo p″, which does not exist when gcd(denominator, pr)≠1.


A.1 Choosing the Encoding Parameters p and r.

Let S be a set of fractions such that:






S
=


{



-
13

/
25

,

23
/
19

,

31
/
5

,

17
/
61

,

48
/
23


}

.





One can choose a prime that is sufficient for encoding and decoding all fractions by simply checking the largest numerator or denominator in absolute value and set it as the value of b and then find the right prime p such that:






p



2


b
2


+

1
.






The largest quantity in S is 61, so we set b=61, which means we need a prime p that satisfies:






p


7

4

4


3
.






The smallest prime to satisfy the above inequality is 7451 which gives N=└√{square root over ((7451−1)/2)}┘=61. That allows us to encode all fractions in S. We emphasize that this process works for any finite set of rationals.


Equivalently, one could choose a small prime which is co-prime with all of the denominators, and then choose an exponent r large enough to allow the fractions to be encoded. For example, p=3 is co-prime with all denominators in S, which means we must choose r large enough so that 3r≥2(61)2+1=7443. That is,







r



log

(

7

443

)

/

log

(
3
)



=

8
.
1
.





So pr=39 also suffices to encode the members of S.


However, can we actually do something with it? If we hope to compute over the image of S, we need to choose a prime (power) that allows “room” for including the outputs of the operations we expect to work with. Instead of choosing a prime from strict parameters, a more conservative approach could be to consider the bit length of the largest numerator or denominator and the function one wishes to compute. If this time we let b be the bit-length of the largest numerator or denominator in absolute value and the function be f (x1, x2, . . . , xn)=x1x2 . . . xn, then we need a prime that satisfies the following inequality:










"\[LeftBracketingBar]"

p


"\[RightBracketingBar]"


bits

>


2

bn

+
1.





Say that we have n=5. Since 61 is a 6-bit number, we set b=6. We now need a prime such that:










"\[LeftBracketingBar]"

p


"\[RightBracketingBar]"


bits

>
61.




We choose p=3693628617552068003, a 62-bit prime which gives us the following encodings of the members of S:








h
1

=



H
p

(


-
13

/
25

)

=
3102648038743737122


,








h
2

=



H
p

(

23
/
19

)

=
2138416568056460424


,








h
3

=



H
p

(

31
/
5

)

=
2216177170531240808


,








h
4

=



H
p

(

17
/
61

)

=
3390872173490423085


,








h
5

=



H
p

(

48
/
23

)

=
321185097178440698


,




and we can check that













i
=
1

5



h
i



mod

p

=
2444130464540096986




which decodes to








H
p

-
1


(
2444130464540096986
)

=


-
328848

144875





and matches








-

13
25


·

23
19

·

31
5

·

17
61

·

48
23


=



-
328848

144875

.





This example shows the intuition behind Proposition 7 and Definition 8.


B Supplemental: Extending Farey Rationals for Larger Input Space

Extending the set custom-characterN. While the Farey rationals custom-characterN have a very simple description and are easy to work with, they have a downside: their size. For example, if p=907, then N =21 and the cardinality of custom-characterN is 559. This means that 907−559=348 integers in custom-character907 do not have a pre-image (under H907−1) in custom-characterN. We address this by extending custom-characterN to a set custom-characterN,g.


Definition 9 (Extended Farey Rationals). For a positive integer g, the extended Farey rationals are defined as the set of reduced fractions:








N
,
g




{



x
y





h



g


such


that



MEEA

(

g
,
h

)





,


gcd

(

g
,
y

)

=
1


}

.





Clearly custom-characterNcustom-characterN,g. We also note that for all m∈custom-characterN,g, Hg−1(Hg(m))=m (generalize proof of Proposition 1(i)). The following lemma provides a necessary, though not sufficient, condition for a rational number to be in custom-characterN,g.


Proposition 11. Let g be a positive integer, and N=└√{square root over ((g−1)/2)}┘. If x/y∈custom-characterN,g, then |x|≤N and |y|≤2N+1.


Proof. Let h∈custom-characterg, and suppose Hg−1(h)=x/y. By definition of MEEA, x/y=xi/yi for some xi, yi computed by the EEA. That |x|≤N is immediate from the definition of Hg−1 (i.e., the stopping condition in MEEA). The outputs of the EEA satisfy:










"\[LeftBracketingBar]"


y
k



"\[RightBracketingBar]"





x
0


x

k
-
1




,




for all k.


By definition, xi−1 >N. Whence, for N′=√{square root over ((g−1)/2)},










"\[LeftBracketingBar]"


y
i



"\[RightBracketingBar]"




g

x

i
-
1



<

g

N



<




2



(

N


)

2


+
1


N



·


=


2


N



+

1

N









It follows that










"\[LeftBracketingBar]"


y
i



"\[RightBracketingBar]"







2


N



+

1

N









2

N

+
1


,




completing the proof.


This proposition simplifies the process of deciding whether a given reduced rational number x/y is in custom-characterN,g:











If





"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"




N

,




"\[LeftBracketingBar]"

y


"\[RightBracketingBar]"



N

,


and



gcd

(

g
,
y

)


=
1

,


then



x
y




N





N
,
g


.






(
i
)














If





"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"



>

N


or





"\[LeftBracketingBar]"

y


"\[RightBracketingBar]"



>


2

N

+
1


,


or



gcd

(

g
,
y

)


>
1

,


then



x
y






N
,
g


.






(
ii
)














If





"\[LeftBracketingBar]"

x


"\[RightBracketingBar]"




N

,

N
<



"\[LeftBracketingBar]"

y


"\[RightBracketingBar]"





2

N

+
1


,


and



gcd

(

g
,
y

)


=
1

,


then



x
y





N
,
g







(
iii
)







if and only if








H
g

-
1


(


H
g

(

x
y

)

)

=

x
/

y
.






Two Options for the Message Space. For a fixed positive integer g, we now have two sets of rationals which can serve as the domain of the encoder:

    • the Farey rationals custom-characterN, and
    • the extended Farey rationals custom-characterN,g.


The advantage of custom-characterN is its simplicity. custom-characterN,g, on the other hand, is larger than custom-characterN and, when g is prime, has exactly g elements.


Hardware Implementation for an Embodiment (FIG. 1)


FIG. 1 is a block diagram 100 of the hardware implementation for an embodiment. A source computing device 102 is connected over an electronic network/bus connection 108 to an intermediary computing device 104 and a destination device 106. Likewise, the intermediary computing device 104 and destination computing device 106 are, in turn, connected to each other 104, 106 as well as to the source computing device 102 over the electronic network/bus connection 108. The intermediary computing device 104 is optional and if the intermediary computing device 104 is not present, the source computing device 102 is connected over the electronic network/bus connection 108 to the destination computing device 106.


In the embodiment shown in FIG. 1, the source computing device 102 acts as the source of the encrypted data 110 and the source computing device 102 sends the encrypted data 110 over the network/bus connection 108 to the intermediary computing device 104 and/or the destination computing device 106. When the intermediary computing device 104 receives the encrypted data 110 from the source computing device 102, the intermediary computing device 104 may perform homomorphic arithmetic operations (addition, subtraction, and/or multiplication) with at least one additional ciphertext to obtain a result ciphertext 110 that the intermediary computing device 104 may then send over the network/bus connection 108 to the destination computing device 106. The destination computing device 106 may decrypt the received encrypted ciphertext(s) 110 to obtain unencrypted data reflecting either the original integer data value(s) if the ciphertext(s) 110 was the original ciphertext(s) sent by the source computing device 102 or an unencrypted result(s) of the arithmetic operations performed by the intermediary computing device 104 if the received ciphertext(s) 110 is a result ciphertext(s) sent by the intermediary computing device 104 after performing homomorphic arithmetic operations with the original ciphertext(s) and at least one additional ciphertext. The destination device 104 generally acts as a final destination for the encrypted data 110 received from the network/bus connection 106 intended for decryption.


The encrypted data 110 starts at the source computing device as one or more rational numbers (e.g., of the form x/y). An embodiment at the source 102 encodes the rational numbers into corresponding integers as a function of p-adic arithmetic performed on the rational numbers. The p-adic generated integers have homomorphic properties due to the p-adic arithmetic operations and are compatible with a Homomorphic Encryption (HE) system, including existing Fully Homomorphic Encryption (FHE) systems such as AGCD based systems like IDGHV scheme based systems and/or RWLE based systems like ModFV scheme based systems. An embodiment delivers the p-adic generated integer(s) to the Encryption portion of the FHE system 112 running on the source device for encryption of the integer data. The original or result ciphertext(s) 110 received at the destination device 106 is decrypted by the Decryption portion of the FHE system 114 running on the destination computing device 106 into a p-adic compatible integer(s). An embodiment on the destination device 106 decodes the decrypted integer(s) into corresponding rational numbers to obtain the ultimate desired values.


Generally, communications, including concealed/encrypted communications, are bi-directional such that the source 102, intermediary 104, and destination 106 computing devices may change roles as the encrypted data 110 source 102, intermediary 104, and the encrypted data 110 destination 106 as is necessary to accommodate the transfer of data back and forth between the computing devices 102, 104, 106. Notably, the intermediary computing device 104 does not require knowledge of the secret keys to perform the homomorphic arithmetic operations, so it is likely that the intermediary computing device 104 will be at least computationally isolated from the source 102 and destination 106 computing devices. Additionally, while the computing devices 102, 104, 106 are depicted as separate devices in FIG. 1, the functionality of the source computing device 102, the intermediary 104 and the destination device 106 may be shared on a single computing system/device or among two or more computing devices as it is often desirable to conceal data when transferring data between components of a single device.


Further, as shown in FIG. 1, the source 102 and destination 106 computing devices appear to be laptop computers and the intermediary computing device appears as a “cloud” that may represent one or several devices connected on the network 108 performing homomorphic arithmetic computations without a need to decrypt to the data 110 to obtain the correct decrypted value for the arithmetic operations. Generally, any computing device capable of communication over any form of electronic network or bus communication platform 106 may be one or more of the source 102, the intermediary 104, and destination 106 computing devices. Additionally, the source 102, intermediary 104 and/or destination 106 computing devices may actually be the same physical computing device communicating over an internal bus connection 108 with itself, but still desiring to encrypt transferred data to ensure that an attacker cannot monitor the internal communications bus 108 to obtain sensitive data communications in an unencrypted format.


Various embodiments may implement the network/bus communications channel 108 using any communications channel 108 capable of transferring electronic data between the source 102, intermediary 104, and destination 106 computing devices. For instance, the network/bus communication connection 108 may be an Internet connection routed over one or more different communications channels during transmission between the source 102, intermediary 104, and destination 106 devices. Likewise, the network/bus communication connection 108 may be an internal communications bus of a computing device, or even the internal bus of a processing or memory storage Integrated Circuit (IC) chip, such as a memory chip or a Central Processing Unit (CPU) chip. The network/bus communication channel 108 may utilize any medium capable of transmitting electronic data communications, including, but not limited to: wired communications, wireless electro-magnetic communications, fiber-optic cable communications, light/laser communications, sonic/sound communications, etc., and any combination thereof of the various communication channels.


The various embodiments may provide the control and management functions detailed herein via an application operating on the source 102, intermediary 104, and/or destination 106 computing devices. The source 102, intermediary 104, and/or destination 106 computing devices may each be a computer or computer system, or any other electronic devices capable of performing the communications and computations of an embodiment. The source 102, intermediary 104, and/or destination 106 devices may include, but are not limited to: a general-purpose computer, a laptop/portable computer, a tablet device, a smart phone, an industrial control computer, a data storage system controller, a CPU, a Graphical Processing Unit (GPU), an Application Specific Integrated Circuit (ASIC), and/or a Field Programmable Gate Array (FPGA). Notably, the first 102, second 104, and/or third 106 computing devices may be the storage controller of a data storage media (e.g., the controller for a hard disk drive) such that data delivered to/from the data storage media is always encrypted so as to limit the ability of an attacker to ever have access to unencrypted data. Embodiments may be provided as a computer program product which may include a computer-readable, or machine-readable, medium having stored thereon instructions which may be used to program/operate a computer (or other electronic devices) or computer system to perform a process or processes in accordance with the various embodiments. The computer-readable medium may include, but is not limited to, hard disk drives, floppy diskettes, optical disks, Compact Disc Read-Only Memories (CD-ROMs), Digital Versatile Disc ROMS (DVD-ROMs), Universal Serial Bus (USB) memory sticks, magneto-optical disks, ROMs, random access memories (RAMs), Erasable Programmable ROMs (EPROMs), Electrically Erasable Programmable ROMs (EEPROMs), magnetic optical cards, flash memory, or other types of media/machine-readable medium suitable for storing electronic instructions. The computer program instructions may reside and operate on a single computer/electronic device or various portions may be spread over multiple computers/devices that comprise a computer system. Moreover, embodiments may also be downloaded as a computer program product, wherein the program may be transferred from a remote computer to a requesting computer by way of data signals embodied in a carrier wave or other propagation medium via a communication link (e.g., a modem or network connection, including both wired/cabled and wireless connections).


Operational Flow Chart for an Embodiment (FIG. 2)


FIG. 2 is a flow chart 200 of operations for an embodiment. At process 208, the source computing device 202 encodes at least one rational number (e.g., x/y) into at least one corresponding HE compatible integer using p-adic arithmetic that provides the homomorphic capabilities of the p-adic generated integers. At process 210, the FHE system running on the source computing device 202 encrypts the at least one HE compatible integer into at least one ciphertext. At process 212, the source computing device 202 sends the at least one ciphertext to the destination computing device 206 if no homomorphic calculations are desired, or to the intermediary computing device 204 if homomorphic calculations are desired.


The processes 214-216 of the intermediary computing device 204 are not necessary if it is not desired to perform homomorphic calculations with at least one additional ciphertext to obtain a result ciphertext, in which case the original at least one ciphertext may simply be sent to the destination computing device 206 for decryption. Assuming homomorphic calculation operations are desired, at process 214, the intermediary computing device 204 homomorphically computes at least one arithmetic function with the at least one ciphertext and at least one additional ciphertext in accord with to obtain at least one result ciphertext. The potential arithmetic functions are one or more of addition, subtraction, and multiplication. Notably, the intermediary computing device 204 does not have knowledge to be able to decrypt any ciphertext meaning the arithmetic functions performed in process 214 at the intermediary computing device are performed homomorphically with encrypted data. Process 214 performs the necessary operations to perform homomorphic calculations on encrypted data. At process 216, the intermediary computing device 204 sends the at least one result ciphertext to the destination computing device 206.


At process 218, the destination computing device 206 decrypts the at least one ciphertext or the at least one result ciphertext into at least one unencrypted p-adic compatible integer value in accord with the FHE system running on the destination computer 206. At process 220, the destination computing device 206 decodes the integer/result integer into at least one corresponding rational number (e.g., x/y)/result rational number (e.g., xr/yr) using inverse p-adic arithmetic.


The FHE system running on the source device 202 and the destination device should be of the same type. The various p-adic rational number to integer encoding/decoding embodiments are compatible with both AGCD based FHE systems like IDGHV scheme based systems and/or RWLE based FHE systems like ModFV scheme based systems. For the AGCD based FHE system (e.g., IDGHV), the at least one rational number may be a single rational number. In the case of the single rational number for the AGCD based FHE system, the p-adic encoding of the various embodiments further encodes the single rational number as a function of the Chinese Remainder Theorem (CRT) algorithms. For the AGCD based FHE system, when the at least one rational number is a multivariate vector of rational number, the p-adic encoding of the at least one rational number is performed component wise of the multivariate vector of rational numbers. For the RWLE based FHE system (e.g., ModFV), a mapping parameter bn+1 of the p-adic arithmetic has number base b and power n chosen such that the mapping parameter bn+1 is prime. Alternatively, for the RWLE base THE system, the mapping parameter bn+1 of the p-adic arithmetic may have number base b and power n chosen such that the mapping parameter bn+1 is not prime, but that has co-prime factors of mapping parameter bn+1 and mapping of the p-adic arithmetic is also defined by the Chinese Remainder Theorem (CRT) algorithms.


Additionally, while the flow charts and flow chart details described above with respect to FIG. 2 describe a methodology that may be embodied as a method or process, another embodiment may be recognized as a computer system, and/or as an intermediary computing device that stores and/or performs homomorphic operations of encrypted data by implementing the processes described above with respect to the flow chart and flow chart details of FIG. 2. Further, in describing the computing system, and/or the intermediary computing system, one, or more, individual processes described above for the methodology may be broken down and represented as a subsystem of the overall encryption computer system. A subsystem of the computer system, in whole or in part, may be assigned to a particular hardware implemented system, such as a dedicated Application Specific Integrated Circuit (ASIC) or Field Programmable Gate Array (FPGA). One or more subsystems, in whole or in part, may alternatively be implemented as software or firmware instructions defining the operation of a computer system with specific regard to the one or more subsystems implemented as software or firmware instructions. The software or firmware instructions may cause the Central Processing Unit, memory, and/or other systems of a computer system to operate in particular accordance with the particular one or more subsystems designated features.


The foregoing description of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and other modifications and variations may be possible in light of the above teachings. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application to thereby enable others skilled in the art to best utilize the invention in various embodiments and various modifications as are suited to the particular use contemplated.

Claims
  • 1. A method for Homomorphic Encryption (HE) compatible encoding and decoding of rational data for encrypted data transmission with a Fully Homomorphic Encryption (FHE) system between a source computing device and a destination computing device, the method comprising: encoding by said source computing device at least one rational number x/y into at least one integer corresponding to said at least one rational number x/y as a function of p-adic arithmetic performed on each of said at least one rational number x/y such that said at least one integer retains homomorphic properties;encrypting by said source computing device said at least one integer into at least one ciphertext with said FHE system operating on said source computing device;sending by said source computing device said at least one ciphertext to said destination computing device;decrypting by said destination computing device said at least one ciphertext into said at least one integer with said FHE system operating on said destination computing device; anddecoding by said destination computing device said at least one integer into said at least one rational number x/y corresponding to said at least one integer as a function of inverse p-adic arithmetic performed on each of said at least one integer.
  • 2. The method of claim 1: wherein said process of sending by said source computing device said at least one ciphertext to said destination computing device instead sends said at least one ciphertext to an intermediary computing device;wherein the method of claim 1 further comprises: homomorphically computing by said intermediary computing device at least one arithmetic function with said at least one ciphertext and at least one additional ciphertext to obtain at least one result ciphertext; andsending by said intermediary computing device said at least one result ciphertext in place of said at least one ciphertext to said destination computing device;wherein said process of decrypting by said destination computing device said at least one ciphertext into said at least one integer instead decrypts said at least one result ciphertext into at least one result integer; andwherein said process of decoding by said destination computing device said at least one integer into said at least one rational number x/y instead decrypts said at least one result integer into at least one result rational number xr/yr such that said at least one result rational number xr/yr equals an unencrypted computation of said arithmetic functions of unencrypted forms of said at least one ciphertext and said at least one additional ciphertext.
  • 3. The method of claim 2 wherein said at least one arithmetic function is at least one of a group of arithmetic functions chosen from: addition, subtraction, and multiplication.
  • 4. The method of claim 1 wherein said FHE system is an Approximate Greatest Common Devisor (AGCD) based FHE system.
  • 5. The method of claim 4 wherein said AGCD based FHE system is further based on an Integer—Dijk, Gentry, Halevi, and Vaikuntanathan (IDGHV) scheme.
  • 6. The method of claim 4: wherein said at least one rational number x/y is a single rational number x/y; andwherein said process of encoding said at least one rational number x/y into at least one integer corresponding to said at least one rational number x/y as a function of p-adic arithmetic further encodes said at least one rational number x/y as a function of Chinese Remainder Theorem (CRT) algorithms.
  • 7. The method of claim 4: wherein said at least one rational number x/y is a multivariate vector of rational numbers x/y;wherein said process of encoding said at least one rational number x/y into at least one integer corresponding to said at least one rational number x/y as a function of p-adic arithmetic further encodes said at least one rational number x/y component-wise of said multivariate vector of rational numbers x/y.
  • 8. The method of claim 1 wherein said FHE system is a Ring Learning With Error (RLWE) based FHE system.
  • 9. The method of claim 8 wherein said RWLE based FHE system is further based on a Fan and Vercauteren (FV) scheme modified for encrypting integers (ModFV).
  • 10. The method of claim 8 wherein a mapping parameter bn+1 of said p-adic arithmetic has number base b and power n chosen such that said mapping parameter bn+1 is prime.
  • 11. The method of claim 8 wherein a mapping parameter bn+1 of said p-adic arithmetic has number base b and power n chosen such that said mapping parameter bn+1 is not prime, but that has co-prime factors of mapping parameter bn+1 and mapping of said p-adic arithmetic is defined by Chinese Remainder Theorem (CRT) algorithms.
  • 12. A PIE (p-adic encoding) system that encodes and decodes rational data with Homomorphic Encryption (HE) compatibility for encrypted data transmission with a Fully Homomorphic Encryption (FHE) system between a source computing device and a destination computing device, the PIE system comprising: said source computing device, wherein said source device further comprises: a PIE encode subsystem that encodes at least one rational number x/y into at least one integer corresponding to said at least one rational number x/y as a function of p-adic arithmetic performed on each of said at least one rational number x/y such that said at least one integer has homomorphic properties and is HE compatible;said FHE system operating on said source computing device that encrypts said at least one integer into at least one ciphertext;a ciphertext send subsystem that sends said at least one ciphertext to said destination computing device;said destination computing device, wherein said destination computing device further comprises: said FHE system operating on said destination computing device that decrypts said at least one ciphertext into said at least one integer; anda PIE decode subsystem that decodes said at least one integer into said at least one rational number x/y corresponding to said at least one integer as a function of inverse p-adic arithmetic performed on each of said at least one integer.
  • 13. The PIE system of claim 12: wherein said ciphertext send subsystem that sends said at least one ciphertext to said destination computing device instead sends said at least one ciphertext to an intermediary computing device;said intermediary computing device, wherein said intermediary computing device further comprises: a homomorphic computation subsystem that homomorphically computes at least one arithmetic function with said at least one ciphertext and at least one additional ciphertext to obtain at least one result ciphertext; andan intermediary ciphertext send subsystem that sends said at least one result ciphertext in place of said at least one ciphertext to said destination computing device;wherein said FHE system operating on said destination computing device that decrypts said at least one ciphertext into said at least one integer instead decrypts said at least one result ciphertext into at least one result integer; andwherein said PIE decode subsystem that decodes said at least one integer into said at least one rational number x/y instead decrypts said at least one result integer into at least one result rational number xr/yr such that said at least one result rational number xr/yr equals an unencrypted computation of said arithmetic functions of unencrypted forms of said at least one ciphertext and said at least one additional ciphertext.
  • 14. The PIE system of claim 13 wherein said at least one arithmetic function is at least one of a group of arithmetic functions chosen from: addition, subtraction, and multiplication.
  • 15. The PIE system of claim 12 wherein said FHE system is an Approximate Greatest Common Devisor (AGCD) based FHE system.
  • 16. The PIE system of claim 15 wherein said AGCD based FHE system is further based on an Integer—Dijk, Gentry, Halevi, and Vaikuntanathan (IDGHV) scheme.
  • 17. The PIE system of claim 15: wherein said at least one rational number x/y is a single rational number x/y; andwherein said PIE encode subsystem further encodes said at least one rational number x/y as a function of Chinese Remainder Theorem (CRT) algorithms.
  • 18. The PIE system of claim 15: wherein said at least one rational number x/y is a multivariate vector of rational numbers x/y;wherein said PIE encode subsystem further encodes said at least one rational number x/y component-wise of said multivariate vector of rational numbers x/y.
  • 19. The PIE system of claim 12 wherein said FHE system is a Ring Learning With Error (RLWE) based FHE system.
  • 20. The PIE system of claim 19 wherein said RWLE based FHE system is further based on a Fan and Vercauteren (FV) scheme modified for encrypting integers (ModFV).
  • 21. The PIE system of claim 19 wherein a mapping parameter bn+1 of said p-adic arithmetic has number base b and power n chosen such that said mapping parameter bn+1 is prime.
  • 22. The PIE system of claim 19 wherein a mapping parameter bn+1 of said p-adic arithmetic has number base b and power n chosen such that said mapping parameter bn+1 is not prime, but that has co-prime factors of mapping parameter bn+1 and mapping of said p-adic arithmetic is defined by Chinese Remainder Theorem (CRT) algorithms.
CROSS REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of U.S. provisional application Ser. No. 63/386,700, filed Dec. 9, 2022, entitled “PIE p-adic Encoding for High-Precision Arithmetic in Homomorphic Encryption,” all of which is also specifically incorporated herein by reference for all that it discloses and teaches.

Provisional Applications (1)
Number Date Country
63386700 Dec 2022 US