An Accelerator to Additive Homomorphism to Handle Encrypted Data

Homomorphic encryption provides a way to operate on the encrypted data so that the users can be given with the maximum feasible privacy. Homomorphic encryption is a special kind of encryption mechanism that can resolve security and privacy issues with rich text. Research gap is the performance overhead associated with this which poses a barrier to the real time implementation of this scheme. The objective of this work is to implement an algorithm to achieve increased performance and faster execution when compared with a classical cryptographical algorithm, the Paillier Cryptographical Algorithm, which is predominantly used to achieve additive homomorphism and analyse the performance gain obtained by this algorithm. The same algorithm is also integrated into an encrypted database application, CryptDB, developed by the MIT, as a replacement to the Paillier algorithm used in the application. The derived algorithms are 2600 time faster in key generation, 5 lakh times faster in encryption, and 3500 times faster in decryption, when compared with the Paillier algorithm.


INTRoDUCTIoN
In this modern world, people use a wide range of applications and they rely on these applications for their data security.There are numerous encryption algorithms in the world and every algorithm serves a specific purpose.But as encryption methods evolve, the art of breaking encryption algorithms also evolved.Simple encryption methods are used till late 19th centuries.The problem with those were, they can be easily broken by a human mind without any additional resources.But after late 19th century encryption algorithms are made with super protection, so that a human could not break it without any resources.But all it took was days or weeks to break them.And then the invention of computers led to public key, private key encryption methods.An advanced hybrid scheme of public key encryption is discussed by Jung et. al., (2015) and elaborated a new method called homomorphic encryption which is explained below.
In Cryptography, encryption is a process of encoding certain sensitive information and store it in a manner that the encrypted data cannot be read without a secret key.With different security attacks being developed every day, there is a dire need for these algorithms to hold the data in an encrypted manner.Some of the common encryption algorithms known to the world are AES, DES, Blowfish, Twofish, RSA algorithms, etc.One such well used algorithm (Rajesh et. al., (2023) is Homomorphic encryption.It was proposed by Rivest, Adleman, and Dertouzos in 1978.The early stage of homomorphic encryption was really a tough process (Ryu et. al., (2023).Yang et. al., (2012) did an impressive job on finding and proving the homomorphic properties of integers, which provides a vivid view of homomorphic encryption.Almost 90 percent of banks either rent cloud storage or hire a group of technicians from an organization to help them store client's data.They will encrypt and decrypt client's data on sending and receiving.But while operating them they can't do that.This particular vulnerability leads to a situation where everything that has been done before had gone wasted.
These kinds of problems can be solved using methods like Homomorphic encryption.A new fully homomorphic encryption method is discussed by Mahmood et. al., (2018).Besides that, how multiple and multistage partial homomorphic encryption is used to develop a fully homomorphic encryption method is described and these two technologies are used in cloud applications.Homomorphic encryption allows us to perform calculations on encrypted data without decrypting it in the first place, and when decrypted the output is the same as if these operations are performed on the unencrypted data.For example, there is an algorithm called Paillier, which can perform addition and multiplication on encrypted data.Other than these operations Homomorphic addition and paillier are used in many other departments.As in Li et. al., (2021) the privacy concern in IoT is a big challenge in IoT applications and services, so this problem is encountered with Homomorphic encryption.In addition to this, paillier is used in homomorphic volume rendering as discussed by Mazza et. al., (2021).
However, the classical paillier based Homomorphic encryption does provide results for few operations, the performance of paillier algorithm is not up to mark and it consumes more cycles during runtime.Paillier encryption method's homomorphic properties are thoroughly analysed in Nassar et. al., (2015).This work theoretically stated an algorithm that can beat the traditional Paillier algorithm in addition operation.They named it Fast Additive Homomorphic Encryption, for sort FAHE.The basic idea of this paper is based on fast additive homomorphic encryption.ACD is also the same method that has been used in Eduardo et. al., (2020).Zhang et. al., (2016) provides enough information about fully homomorphic encryption method over integers.Other than that it is also specifies how to accelerate the already exist homomorphic mechanism but only for integers.The proposed algorithm defeated Paillier in every single efficient test.But algorithms aren't of use without an application to employ them.One such application where the FAHE algorithm can be effectively applied to yield better results is, Cryptdb.Cryptdb is an MIT licensed product.This Crypt-dDB executes encrypted queries over the encrypted data stored.It provides basic database operated on the encrypted data using encrypted queries.Cryptdb already employs Paillier to perform addition and multiplication.This algorithm consumes a lot of cycles during runtime and it results in increased runtime of the encrypted queries run by cryptdb.The FAHE algorithm can be used as an effective replacement in this case, considering it has better performance over the paillier system without the loss of functionalities.
There are numerous encryption algorithms applied in real world application.Specific algorithms provide specific use cases.One such algorithm is Homomorphic Encrpytion.Homomorphic encryption allows us to perform operations on encrypted data and the results would as similar as though the operations are performed on original data.
However, the classical paillier based Homomorphic encryption does provide results for few operations, the performance of paillier algorithm is not upto mark and it consumes more cycles during runtime.This makes the paillier algorithm flawed and there is a dire need to replace the existing algorithm with a much faster one and with stronger encryption as the former.Also the paillier system uses asymmetric key system which uses different keys for the processes of encryption and decryption.
The paillier homomorphic algorithm can be used as a direct replacement in many application.One such application is "CryptDB", an MIT licensed product.This CryptdDB executes encrypted queries over the encrypted data stored.It provides basic database operated on the encrypted data using encrypted queries.This product uses paillier system as its base algorithm which has high "overhead".The algorithm consumes a lot of cycles during runtime and it results in increased runtime of the encrypted queries run by cryptdb.
Though the paillier system as numerous advantages on the field on Homomorphic encryption considering its security parameters and strengths, it also has defects in its own accord, Such as the asymmetric key system, high overhead and increased utilization of cycles.The most important drawback of paillier system is that it is not quantum-resistant meaning that they are vulnerable to the attacks by quantum super computers and Artificial Super Intelligences in future.
To solve all these disadvantages, the "Fast Additive Homomorphic Encryption" algorithm is used as an effective replacement for the paillier scheme.It uses symmetric key system and consumption of cycles are considerably lesser than that of paillier system.The most important key feature of this algorithm is that is uses the concept of "Approximate Common Divisor" problem which is seemed to be quantum-resistant and hence the Fast Additive algorithm can be concluded as quantum resistant.
With respect to the Crytdb architecture, it uses paillier system as its homomorphic layer.The new Fast additive algorithm developed can be used as an effective drop-in replacement for paillier algorithm and the overall performance of the CryptDB queries can be surged and the overhead can be brought down to great extent.
The rest of the paper is organized as follows: Section 2 gives an overview of the related works.Section 3 details the architecture diagram.Section 4 provides a detailed description of all the modules separately along with block diagrams.Section 5 describes the implementation of the algorithm, integration of the same into the CryptDB and the screenshots of the corresponding outputs.Section 6 presents the evaluation of the work and the performance measure comparison with the existing system.

RELATED woRKS
In this section, a brief review of the literature about homomorphic encryption, discussing the nuances and state of knowledge in the area, is presented.There are a lot of related works in the topic of Homomorphic encryption and related algorithms.Yang et. al., (2012) presented a very simple somewhat homomorphic encryption scheme over the integers.However, this simplicity came at the cost of a public key size in O(λ 10).Although at Crypto 2011 Coron et al. reduced the public key size to O(λ 7), it was still too large for practical applications.In this paper the public key size is further reduced to O(λ 3) by encrypting with a new form.The semantic security of our scheme is based on approximate-GCD problem of two integers.By using Gentry's techniques, we can easily convert the somewhat scheme into a practical fully homomorphic encryption scheme available in cloud computing.Chaudhary et. al., (2019) mainly emphasizes on full homomorphic encryption and an investigation of different full homomorphic encryption schemes that uses the hardness of Ideal-lattice, integers, learning with error, elliptic curve cryptography based.Calculations can be carried out on encrypted form of data is the essence of homomorphic encryption.Homomorphic encryption has resolved the security issues for storing data on the third-party systems.Most significant category of homomorphic encryption is fully homomorphic encryption.It permits unbounded number of operations on the encrypted form of data and output by system is within the ciphertext space.This paper provides the essentials of Homomorphic encryption and its various classifications i.e. partially homomorphic encryption, somewhat homomorphic encryption and fully homomorphic encryption Mahmood et. al., (2018) built a hybrid homomorphic encryption scheme based on the GM encryption algorithm which is additively single bit homomorphic, and RSA algorithm which is multiplicative homomorphic.The hybridization of homomorphic encryption schemes seems to be an effective way to defeat their limitations and to benefit from their resistance against the confidentiality attacks.This hybridization of homomorphic encryption algorithm lead to increase the speed 2.9 times, reduce the computation time to 66 percentage from previous one, enhanced confidentiality of the data that is stored in the cloud by enhancing security.
Also, paillier's encryption and its property to privacy-preserving computation outsourcing can be implemented on applications such as secure online voting.Nassar et. al., (2015) presented a new implementation of Paillier's cryptosystem using Python as for interface language and fast GMP C -routines for arithmetic operations.This paper also reviewed homomorphic encryption and its applications in arising cloud security issues.They presented a new and efficient implementation of Paillier's additive homomorphic encryption.Finally it reviewed on a subset of applications of Paillier's encryption in recent cloud security and privacy research.It doesn't claim in any means to be comprehensively addressing homomorphic encryption schemes or their applications.In Pallavi et. al., (2020) the study of the Paillier homomorphic secret writing theme is conducted.From the additive homomorphic property of the Paillier Cryptosystem, an approach that will facilitate in reducing the information measure throughout the transmission of the file and can create the system additional economical was studied.
Based on the public key compressing technique and the Chinese Remainder Theorem, an efficient somewhat homomorphic encryption (SWHE) scheme is proposed, whose security can be reduced to the approximate greatest common divisor problem.Then the fully homomorphic encryption scheme is obtained by using Gentry's squashing decryption circuit technique, which could resist chosen plaintext attacks.The efficiency analysis shows that the newly developed SWHE scheme's public key size presented by Zhang et. al., (2016) and cipher text size are reduced compared to DGHV scheme.And the simulation results show that the multiplication of the pro-posed SWHE scheme is much more efficient than that of DGHV scheme.HE consists of somewhat homomorphic encryption (SWHE) and fully homomorphic encryption (FHE).SWHE only evaluates low degree polynomials, while FHE allows anyone to perform arbitrary computations on the ciphertext.Because of this attractive property, FHE would allow computation services supplied by the third party without exposing the data, which is suitable to compute the encrypted data on cloud computing, e.g.cipher-text search, homomorphic machine learning and etc.
By Luan et. al., (2015) an implementation of a DGHV scheme variant using Python and the GMPY2 library has been developed.New researches in the field of homomorphic encryption schemes have made it possible to implement a variety of schemes using different techniques and programming languages This scheme was first proposed in 2010, by van Dijk et al, and later modified into two variants by Coron in 2011 and 2012, which reduced the prohibitive size of the public keys, at the cost of computational power.Besides that, this paper also presents a comparison of these implementations with the previous implementation of Coron's first variant.A fully homomorphic encryption (FHE) scheme is a cryptosystem that allows one, using only public data, to compute an arbitrary computation on the ciphertext, and get as result the encrypted computation over the plain text.In other words, having a computation f(), a message m and the encryption of said message E(m), there is a function f1 such as f1(E(m)) = E(f(m)).This characteristic is very desirable, as it allows secure processing on secret data to be executed by an unsecure third part without unencrypting the data.
Ring learning with errors (Ring-LWE) is the basis of various lattice based cryptosystems.The most critical and computationally intensive operation of Ring-LWE based cryptosystems is polynomial multiplication over rings.By Chaohui et. al., (2016) several optimization techniques to build an efficient polynomial multiplier with the number theoretic transform (NTT) were introduced.A new technique to optimize the bit-reverse operation of NTT and inverse-NTT.With additional optimizations, the polynomial multiplier reduces the required clock cycles from (8n+1.5n lg n) to (2n+1.5nlg n).By exploiting the relationship of the constant factors, the polynomial multiplier is able to reduce the number of constant factors from 4n to 2.5n, which saves about 37.5 ROM storage.In addition, they proposed a novel memory access scheme to achieve maximum utilization of the butterfly operator.With these techniques, the polynomial multiplier is capable to perform 57304/26913 polynomial multiplications per second for dimension 256/512 on a Spartan-6 FPGA.
In a model presented by Jung et. al., (2015) messages are encrypted with a PKE (Public key encryption) and computations on encrypted data are carried out using SHE or FHE after homomorphic decryption.In this model, messages are encrypted with a PKE and computations on encrypted data are carried out using SHE or FHE after homomorphic decryption.To obtain efficient homomorphic decryption, our hybrid scheme combines IND-CPA PKE without complicated message padding with SHE with a large integer message space.Furthermore, if the underlying PKE is multiplicative, the proposed scheme has the advantage that polynomials of arbitrary degree can be evaluated without bootstrapping.They constructed this scheme by concatenating the ElGamal and Goldwasser-Micali schemes over a ring.To accelerate the homomorphic evaluation of the PKE decryption, they introduced a method to reduce the degree of the exponentiation circuit at the cost of additional public keys.Using the same technique, an efficient partial solution to an open problem which is to evaluate mod q mod p arithmetic homomorphically for large p is presented.As an independent interest, we also obtain a generic method for converting from private-key SHE to public-key SHE.Unlike the method described by Rothblum, we are free to choose the SHE message space.
The above mentioned methods are partly helping to complete a process which is mentioned in the work.As the name suggests the algorithms mentioned in partially homomorphic encryption are only of use when one of the two types, i.e addition or multiplication is used.So one cannot use these kind of algorithms to perform both homomorphic operations.The next one Somewhat Homomorphic encryption uses lattice based cryptography to perform addition and multiplication on cipher texts.However, the classical paillier based homomorphic encryption does not provide results for few operations, the performance of paillier is not upto mark and it consumes more cycles during runtime.This makes the paillier algorithm flawed and there is a dire need to replace the existing algorithm with a much faster one and with stronger encryption as the former.Also the paillier system uses assymetric key system which uses different keys for the processes of encryption and decryption.
Fully homomorphic encryption inherits multiple properties from the second method but instead of using lattice based cryptography, this method uses approximate common divisor problem (ACD) which is a NP-Hard problem and quantum resisting.It fully discussed on ACD and fully homomorphic encryption but the difference is it is an Accelerator to the homomorphic addition and uses the ACD method to prove it.
In addition to that the future work mentioned in the paper is also implemented.Cryptdb executes encrypted queries over the encrypted data stored.It provide basic database operated on encrypted data using.It uses Paillier system as its base algorithm which has high "overhead".The algorithm consumes a lot of cycles during run-time and it results in increased runtime of queries run by cryptdb.The contribution of this thesis is replacing the paillier encryption method with the new fully additive homomorphic encryption in Cryptdb and observing the changes in performance of Cryptdb.

EXPERIMENTAL DESIGN
This section presents the detailed block diagram of the entire project.The block diagrams are distinguished into three parts.First, the implementation of the algorithm is presented in a neat manner.Next, how the CryptDB is designed and how it is working is displayed as a separate block diagram.The final diagram describes how the derived algorithm is integrated into the existing CryptDB application as a replacement to the Paillier module to achieve increased performance gain.
Figure 1 displays the working of the algorithm in a detailed manner.The algorithm works by beginning with the initialization of necessary and needed parameters such as lambda, rho, eeta, gamma and p.With those values, encryption and decryption key set are generated as a part of the entire key set of the algorithm.The input plain text message is encoded and then encrypted using the calculated key values.Cipher texts can be added as plain texts for the number of times as defined in the parameter initialization as similar to the normal addition of values.Added encrypted cipher text can be decrypted with the decryption key set to obtain the result as same as the plain text addition.
Figure 2 shows the block diagram of the CryptDB application.The application is designed in such a manner that the front end will be issuing the DML and DDL queries to the database.Before reaching the database server, an intermediate server is set up which will be doing all the necessary steps to work with the encrypted database.All the front end queries will be sent in the encrypted format to the database.With the help of the Onion layer of encryptions and SQL-aware encryption strategies, CryptDB server will encrypt, decrypt and modify the SQL queries to achieve the operations on the encrypted values.The database server will be having only the encrypted values of the user data.
The derived algorithm is applied for the replacement of the Paillier module in the CryptDB application as shown in Figure 3.
Figure 3 shows the integration of the derived algorithm into the CryptDB application.Both the header and cc files of the Paillier module are completely changed with the derived algorithm.Along with those files, some of the other modules of the application are also changed appropriately to ensure the perfect working of the application with the increased performance gain and faster execution of the queries.
The derived algorithm has various parameters for achieving different amount of security levels.These parameters influences the strength of the output cipher text.They can be tuned to achieve the algorithm.There are two algorithms with a slight variation between them.The second one is even faster than the first one and also produces cipher texts in smaller sizes than the former algorithm.Some of the modules of the algorithm are described in detail in the forthcoming sections.

Key Generation
Initializing the necessary parameters before the key generation module, the key generation module will compute certain values needed with the initialized parameters.This will produce a cryptographically unique and random key to encrypt the plain text to cipher text.The key is a set of values of some which will be used for encryption and some will be used for the purpose of decryption.Unlike Paillier cryptosystem, it is a symmetric algorithm wherein a single key set is used for both encryption and decryption operations as shown in Figure 4.
Computing ρ, η and γ from the given parameters and feed them to a formula along with a prime and the formula generates keys for both encryption and decryption.

Encryption
Encryption will use certain values from the generated key set to produce the cipher text.The plain text message input fed to the system is encoded to another format.The encoded message will then further processed to output the cipher text from the given plain text message.The cipher text will be a cryptographically random one for the input plain text.That is, the cipher text will be different in every time for the same plain text and the key set.Thus making it harder for various kinds of crypt analysis.
Plain text is fed into a formula with some noise and the output of this block will be encrypted text as shown in Figure 5.

Decryption
The cipher text is fed to the decryption module to obtain the original plain text.For the decryption process, some other values from the key set is utilized.The algorithm is based on the Approximate Common Divisor (ACD) problem.This is by the fact that the Approximate Common Divisor problem is a hard problem and also post-quantum i.e., the algorithm is resistant to attacks even with quantum computers.To make the algorithm to exhibit quantum-resistant, certain parameters have to be set to meet the necessary conditions.
Cipher text is given as input to this block and processed using a formula and output will be a plain text as shown in Figure 6.

Homomorphic Addition
Homomorphism in security means that operating on encrypted values and then producing the same results as when done on plain text on decryption.Homomorphic addition is adding two cipher texts and achieving the result of addition of them in plain text after decryption.In the derived algorithm, the cipher texts can be added as it is and can be decrypted to get the desired output.The number of additions is limited by the value of a parameter.Yet the parameter can be modified to achieve practically unlimited number of additions using the derived algorithm.
The algorithm is expected to produce better performance for all the operations including key generation, encryption, decryption and homomorphic addition when compared with Paillier cryptosystem.It takes as input, two cipher texts are fed into this unit and gives as output the addition of those two cipher texts as shown in Figure 7.

Pseudo Code
1. Get cipher text c1 2. Get cipher text c2 3. Perform addition using c1 and c2 4. Store the value in a variable c add

Prime Generation
This module gets the length as an input.The length is usually in terms of number of bits that the prime number needs to be generated.A number is generated in random between 2 bits−1 + 1 and 2 bits .This number is checked whether prime or not.The function is executed until a prime number is found.When a prime number is obtained, the same will be returned to the function call.The primality test is done using Rabin Miller Primality test which is an unconditional probabilistic algorithm.
It takes as input, length of the prime number to be generated in bits and gives prime number of given bits in length as shown in Figure 8.

Pseudo Code -Rabin-Miller
Input: n > 3, an odd integer to be tested for primality; Input: k, a parameter that determines the accuracy of the test Output: composite if n is composite, otherwise probably prime write n -1 as 2 s •d with d odd by factoring powers of 2 from n -1 LOOP: repeat k times: pick a randomly in the range [2, n -2] x ← a d mod n if x = 1 or x = n -1 then do next LOOP for r = 1 .. s -1 x ← x 2 mod n if x = 1 then return composite if x = n -1 then do next LOOP return composite return probably prime

CryptDB: Setting Up
CryptDB is an open source experimental modified MySQL database application which operates over completely encrypted values.It works on the basis of SQL Aware Encryption schemes which encrypts data items depends upon the provided SQL queries.The various encryption layers enables the SQL operations over the encrypted values.Sensitive information of the users stored in a third-party cloud service providers poses a huge threat to the privacy of the user data.Thus, CryptDB provides a way to overcome the above described security concern.

Implementation Overview
To overcome the above discussed security threat, CryptDB stores all the user information in encrypted format.For every database query, queries will be sent to the server in encrypted format.These encrypted queries are executed on the encrypted database values and the result is also sent in an encrypted manner.The decryption will take place only at the front end system interface of the authenticated user.
CryptDB utilizes various security algorithms to encrypt the data into various layers.To name some of the algorithms, AES, DES, CBC, HMAC and Paillier.Paillier is used to achieve the HOM (Homomorphic Encryption) layer which is used to perform operations on constants such as adding numerals.Paillier algorithm possess the property of additive homomorphism which will sum numbers in their encrypted format and the decryption yields the summed up value as shown in Figure 9.

Application and Algorithm
Plain text queries fed to the application is converted into encrypted queries and then provided to the database server.Constant values are encrypted in the HOM layer and then stored in the database server.When a query involves operations on the constant values, FAHE1 and FAHE2 are employed instead of Paillier in the CryptDB application.This will yield query results in an efficient manner.
It takes as input, plain text queries are given to the database server which then encrypts and sends the encrypted queries to the database and gives encrypted results which are sent to the database which decrypts and gives plain text results.

Integrating CryptDB with FAHE1 and FAHE2
In this application, homomorphic operations such as addition and multiplication are done with the help of Paillier cryptographical system.These modules are replaced with the derived algorithms FAHE1 & FAHE2 (Fast Additive Homomorphic Algorithm).This helps to reduce the execution time of the encrypted SQL queries and thus provides higher amount of performance gain.The modified application is tested with some sample queries and the performance analysis is bench marked against the standard algorithm for comparison.
It takes as input, plain text queries which involves operations on constants are encrypted and then processed with the HOM layer which comprises the FAHE1 and FAHE2 and gives encrypted results of the homomorphic additive process which on decryption yields the desired results.

EXPERIMENTAL RESULTS
This section provides a detailed description of the implementation of the entire project.First part of this chapter describes how the algorithm is implemented and their corresponding outputs are also shown.The outputs of both FAHE1 and FAHE2 are displayed individually.The next section shows how to set up the CryptDB application to create and run the encrypted databases.The further sections of the chapter explains how to integrate FAHE1 and FAHE2 into the CryptDB as a replacement to the Paillier algorithm and thus improve the performance of the encrypted databases.Some of the changes needed in the other modules of the application are also covered in the below sections.

FAHE1 and FAHE2 Algorithm Implementation
The proposed algorithm is implemented at first as an initial progress towards the project.All the modules in the algorithm such as key generation, encryption, decryption and addition are implemented as individual functions so that the implementation can be extended to a greater amount due to the high amount of cohesion and less coupling between the functionalities.The implemented algorithm is then integrated into the CryptDB to achieve improved performance gain.
The function calls to the functionalities such as key generation, prompt for the user input and encryption.All the implementation details are abstracted inside the individual functions.This improves the readability of the code to a higher amount.Also any future changes to the functions can be employed easily with respect to the necessary modules alone.The implementation details of the functionalities are described in the following sub sections.

FAHE1
To begin the implementation of the algorithm, necessary parameters are first initialized and further needed values are derived from the former parameters.From the Key set, encryption and decryption is performed using the appropriate formulas with the help of the encryption and decryption key sets respectively.

FAHE2
FAHE2 is also implemented in a similar fashion with a small change in the encryption and decryption processes since this involves the application of an additional noise to the algorithm.

Prime Generation
For generating a prime number of given size, a random number is generated and the number is tested whether prime or not.The function will be executed until a prime number is found.For the purpose of testing for prime, RabinMiller primality test is used.This is an unconditional probabilistic algorithm which determines whether a number given is probable to be prime.The random number is generated with the help of the urandom class by initializing with a seed value.Once the generated value possess the property of primality, the same will be returned in a ZZ class format.

Setting Up CryptDB
CryptDB is an encrypted database where all the user data will be stored in an encrypted format and the SQL queries will also be executed over the encrypted values.The application is set up in an Ubuntu 12.04 LTS system with a RAM of size 2 GB and a disk space of 20 GB.Before building the application, necessary packages such as Bazaar, Bison, Gtkdoc, Autoconf, Automake, Libtool, Flex, Gcc-4.6,G++-4.6,Cmake and G++ have been installed into the system with the help of Ubuntu libraries.Then the application is built successfully following the required procedures.Once the output files are generated from the build, MySQL Server has been configured with a proxy using the command shown below.Thus, all the subsequent MySQL Connections to the same back end address will be interrupted by the CryptDB server and operated as an encrypted database.The necessary outputs are shown in the below figures.

FAHE Implementation in CryptDB
Among the various encryption layers in the application, HOM layer of encryption is achieved with the help of the Paillier cryptographical algorithm which possess the property of additive homomorphism.This HOM layer is used when the SQL queries involves operations on the numbers.Thus, under the folder "crypto", Paillier algorithm is implemented in files "paillier.hh"and "paillier.cc".These contains function declarations in the header file and the function definitions in the cpp file of the functionalities key generation, encryption, decryption and addition.These function definitions are modified with the FAHE implementation code appropriately.The function definitions in the header are also changed with the necessary arguments to the function.Thus FAHE1 algorithm is implemented into the CryptDB application replacing the Paillier Cryptographical algorithm.

Changing the Makefrag
For generating random numbers, a linux package called "gmp" has to be implemented.Some of the methods in this package are not linked during compile time implicitly.So they should be linked dynamically in run time.Thus the Makefrag file is modified with a linker flag "-lgmpxx".

Changing the User Defined Functions Handlers
CryptDB utilizes the feature of User Defined Functions (UDF) to create the encrypted database application and also to process the encrypted SQL queries.These UDFs for the respective SQL operations are declared in the "cryptohandlers.cc"file which will make calls to the UDFs for the appropriate encryption algorithms including Paillier.Paillier is used for the purpose of addition of numbers.This will make calls to the "paillier.cc"file which contains code for the implementation of the FAHE.The encrypted addition by the method of FAHE is performed in the User De-fined Function defined in the file "edb.cc" which is located under the folder "udf".Thus the Paillier algorithm used for the purpose of summation is completely replaced by the FAHE algorithm in the CryptDB application.The application is rebuilt and executed to utilize higher performance gain with the SQL queries involving summation.The respective changes in Figures 10,11,12 and 13 show the output of the operations such as insertion, updation and selection of rows in the CryptDB application with FAHE1 and FAHE2 as a replacement to the Paillier algorithm.

RESULTS ANALySIS
In this section, the performances of FAHE1 and FAHE2 are presented and are compared with the performance of the Paillier cryptosystem.The choice of Paillier is motivated by the fact that it is among the most efficient algorithms supporting homomorphic encryption and thus, provides the same functionality as FAHE1 and FAHE2 in a pre-quantum setting.The benchmarked operations were: 1. Key Generation 2. Encryption 3. Decryption

Metrics for Evaluation
The performance of the program is analysed by counting the cycles.Blocks that affect the performance of the algorithm are split and individual cycles of the blocks are counted.For counting the cycles, a python package named "hwcounter" is used.i) start = count is initialized at the start of the block for which the cycles have to calculated.
ii) elapsed = count end() −start at the end of the block can calculate the total number of cycles taken for the individual block.For calculating the total cycles taken for the execution of the program, individual blocks are executed multiple times and average of them are taken and added with other blocks of the program.Finally, the cycles taken for the program are benchmarked against the Paillier system and performance gain is calculated.
In classical crpytDB implementation, the homomorphic layer is implemented using the Paillier cryptosystem, thus enabling additions on encrypted data.In this scenario, FAHE1 and FAHE2 can be seen as efficient and effective drop-in replacements for Paillier.
Finally the runtime of the encrypted queries using both paillier system and FAHE system is calculated to analyze the performance gain the latter has over the former.The outputs of performance it can be observed that the initial step of the algorithm which is the key generation process takes 26 thousand crore cycles wheares the FAHE takes only 10 crore cycles.The encryption and decryption stages of Paillier algorithm takes around 1.5 lakh crore cycles and 72 crore cycles respectively.On the other hand, FAHE takes only 3 lakhs and 1.5 lakhs cycles for the encryption and decryption.This produces an enormous performance gain with FAHE when compared to the classical Paillier algorithm.In addition to these, FAHE is also quantum resistant which will make the algorithm highly secure comparing with the Paillier cryptography which is not quantum resistant in nature.Figure 16 shows the bar graph of the cycles taken by the algorithms for the process of key generation.It is clear from the figure that FAHE1 is 2600 times faster than the classical Paillier algorithm.FAHE2 is also 790 times faster than the Paillier cryptography.Figure 17 shows the elapsed cycles taken for encryption of the plain text.Encryption produces very significant improvement when compared to the Paillier.FAHE1 and FAHE2 take around 2.5 lakhs whereas the Paillier encryption takes nearly 1.5 lakh crore cycles.This shows that the FAHE's are 5 lakh times faster than the Paillier encryption process.FAHE2 also has an advantage of smaller ciphertext when compared to FAHE1.
Figure 18 displays the cycles needed to complete the decryption of the ciphertext generated by the respective algorithms.This also shows impressive results as FAHE1 and FAHE2 take around 1.5 lakh and 2 lakh cycles for the decryption process respectively.On the other hand, the Paillier algorithm takes on the range of 72 crore which stats that the FAHE is nearly 3500 times faster than the Paillier algorithm.Figure 19 shows the bar graph of the cycles for the addition process.The time taken to complete the homomorphic addition in Paillier is slightly higher than other two algorithms.
Table 1 shows a representation of the comparison of the elapsed cycles for all the three algorithms, the Paillier, the FAHE1 and the FAHE2 of their Key generation, Encryption, Decryption and Homomorphic Addi tion.
Figure 20 shows that the CryptDB with the Paillier used for homomorphic operations takes around 0.28 seconds for the first insertion.Updating the HOM constants take around 0.04 to 0.05 seconds with the Pail lier algorithm.
When the CryptDB HOM layer is replaced with the FAHE1 algorithm, first insertion takes around 0.03 seconds and further insertions with the time of 0.01 second.This produces significant performance gain when compared with the Paillier algorithm.Updating a row also occurs at a time period of 0.02 seconds on an average.Figure 21 displays the time taken to complete the insertion and updation in the HOM layer when FAHE2 is used to achieve the homomorphic operations.This also executes the queries in the time period as same as the FAHE1 with an advantage of smaller cipher text when compared with FAHE1.

Test Cases
CryptDB is an encrypted database which takes plain text queries as input from the front end.The front end then encrypts the queries and sends to the database server.All the encryption and decryption are performed by the CryptDB server lying between the end -user and the database server.Any subsequent query to the system is interpreted by the CrybtDB server and the output is produced to the front end after fetching the necessary data from the encrypted database.

System Unit Testing
The application is unit tested using the python package called "unittest".This can be installed with the pip command called "pip install unittest".All the modules of both the application are covered by generating random inputs followed by their encryption and addition of the encrypted values.These values are decrypted with the application module and are compared with the expected output for the generated inputs.The results are displayed in Figure 22 and Figure 23.

CoNCLUSIoN
From what the industry have seen so far, the Fast Additive Homomorphic Encryption algorithms are way faster than the Paillier algorithm in each and every aspect.In key generation there is a difference of two fifty billion in terms of elapsed cycles and in encryption it goes further and reaches a whopping difference of 1 trillion cycles.The closest Paillier encryption can come to FAHE is in Homomorphic addition.But the least difference is two hundred thousand.One cannot decide efficiency based on only Algorithm's performance.There has to be some application which can employ both the encryption methods and tell the difference in real world applications.There comes Cryptdb, a database which can hold thousands of bits of encryted text.It has modules which could be used to operate on data without decrypting them.One of those modules is paillier, which is used to perform multiplication and addition on encrypted data.So FAHE was replaced to find out the performance gain in real world applications and it did well as expected.But FAHE and cryptdb itself has some drawbacks.Noticeably there are some drawbacks to the FAHE algorithms.FAHE out performed the Paillier in every aspect but the main drawback is it doesn't support multiplication.As the name suggests it is additive.But with Paillier supporting both addition and multiplication, one should doubt the replacement cost of paillier.Not only FAHE is defective, but cryptdb itself has some.Cryptdb is developed to operate and store encrypted data.It was developed in 2012 by MIT.But after that the support to cryptdb was stopped and community became inactive.So with today's system architectures one may find it difficult to implement and run without any community support.Cryptdb is developed to implement very few SQL operations.This might be a great problem for those who want to implement a full-fledged secure application.

CoNFLICTS oF INTEREST
We wish to confirm that there are no known conflicts of interest associated with this publication and there has been no significant financial support for this work that could have influenced its outcome.

FUNDING STATEMENT
No funding was received for this work.

Figure
Figure 1.Block diagram

Figure
Figure 4. Block diagram: Key generation

Figure 16 .
Figure 16.Elapsed cycles of key generation