snucrypto / HEAAN

Other
359 stars 94 forks source link

How to get the square root of a ciphertext #1

Closed Luidy closed 6 years ago

Luidy commented 6 years ago

Hello. I want to get the square root of the ciphertext. How can I get the square root? ex) 2.0 -> Convert to ciphertext 'C1' -> Outputs the cryptogram of the square root of 'C1' in the encrypted state

kimandrik commented 6 years ago

Hello. There is no direct square root evaluation in the Scheme. The scheme can evaluate polynomials, and we suggest to find a good polynomial approximation for a square root function for evaluation. There are several examples for evaluating log, exp, sigmoid functions, using Taylor series in TestScheme class. You can apply a similar method to a square root function. In TestScheme you can also find a test for evaluating an inverse using a different from Taylor series polynomial approximation. If you can find a good polynomial approximation for a square root function, you can apply it.