-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathcryptocontext_docs.h
More file actions
1391 lines (1136 loc) · 50 KB
/
cryptocontext_docs.h
File metadata and controls
1391 lines (1136 loc) · 50 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//==================================================================================
// BSD 2-Clause License
//
// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors
//
// All rights reserved.
//
// Author TPOC: contact@openfhe.org
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================
#ifndef __CRYPTOCONTEXT_DOCS_H__
#define __CRYPTOCONTEXT_DOCS_H__
#include "pybind11/pybind11.h"
#include "pybind11/attr.h"
namespace py = pybind11;
// const char* cc_docs = R"doc(
// test
// )doc";
// auto cc_docs2 = py::doc(cc_docs);
const char* cc_SetKeyGenLevel_docs = R"pbdoc(
For future use: setter for the level at which evaluation keys should be generated
:param level: the level to set the key generation to
:type level: int
)pbdoc";
const char* cc_GetKeyGenLevel_docs = R"pbdoc(
For future use: getter for the level at which evaluation keys should be generated
:return: The level used for key generation
:rtype: int
)pbdoc";
const char* cc_GetRingDimension_docs = R"pbdoc(
Get the ring dimension used for this context
:return: The ring dimension
:rtype: int
)pbdoc";
const char* cc_GetPlaintextModulus_docs = R"pbdoc(
Get the plaintext modulus used for this context
:return: The plaintext modulus
:rtype: int
)pbdoc";
const char* cc_GetCyclotomicOrder_docs = R"pbdoc(
Get the cyclotomic order used for this context
:return: The cyclotomic order
:rtype: int
)pbdoc";
const char* cc_GetModulus_docs = R"pbdoc(
Get the cyclotomic order used for this context
:return: The modulus
:rtype: int
)pbdoc";
const char* cc_Enable_docs = R"pbdoc(
Enable a particular feature for use with this CryptoContext
:param feature: the feature that should be enabled.
The list of available features is defined in the PKESchemeFeature enum.
:type feature: PKESchemeFeature
)pbdoc";
const char* cc_KeyGen_docs = R"pbdoc(
Generate a public and private key pair
:return: a public/secret key pair
:rtype: KeyPair
)pbdoc";
const char* cc_EvalMultKeyGen_docs = R"pbdoc(
EvalMultKeyGen creates a key that can be used with the OpenFHE EvalMult operator.
The new evaluation key is stored in cryptocontext.
:param privateKey: the private key
:type privateKey: PrivateKey
)pbdoc";
const char* cc_EvalMultKeysGen_docs = R"pbdoc(
EvalMultsKeyGen creates a vector evalmult keys that can be used with the OpenFHE EvalMult operator.
The 1st key (for s^2) is used for multiplication of ciphertexts of depth 1.
The 2nd key (for s^3) is used for multiplication of ciphertexts of depth 2, etc.
A vector of new evaluation keys is stored in cryptocontext.
:param privateKey: the private key
:type privateKey: PrivateKey
)pbdoc";
const char* cc_EvalRotateKeyGen_docs = R"pbdoc(
EvalRotateKeyGen generates evaluation keys for a list of indices. Calls EvalAtIndexKeyGen under the hood.
:param privateKey: private key
:type privateKey: PrivateKey
:param indexList: list of integers representing the indices
:type indexList: list
:param publicKey: public key (used in NTRU schemes)
:type publicKey: PublicKey
)pbdoc";
const char* cc_MakeStringPlaintext_docs = R"pbdoc(
MakeStringPlaintext constructs a StringEncoding in this context.
:param str: string to be encoded
:type str: str
:return: plaintext
)pbdoc";
const char* cc_MakePackedPlaintext_docs = R"pbdoc(
MakePackedPlaintext constructs a PackedEncoding in this context
:param value: vector of signed integers mod t
:type value: List[int]
:param noiseScaleDeg: is degree of the scaling factor to encode the plaintext at
:type noiseScaleDeg: int
:param level: is the level to encode the plaintext at
:type level: int
:return: plaintext
:rtype: Plaintext
)pbdoc";
const char* cc_MakeCoefPackedPlaintext_docs = R"pbdoc(
MakeCoefPackedPlaintext constructs a CoefPackedEncoding in this context
:param value: vector of signed integers mod t
:type value: List[int]
:param noiseScaleDeg : is degree of the scaling factor to encode the plaintext at
:type noiseScaleDeg : int
:param level: is the level to encode the plaintext at
:type level: int
:return: plaintext
:rtype: Plaintext
)pbdoc";
const char* cc_MakeCKKSPackedPlaintextComplex_docs = R"pbdoc(
COMPLEX ARITHMETIC IS NOT AVAILABLE, AND THIS METHOD BE DEPRECATED. USE THE REAL-NUMBER METHOD INSTEAD. MakeCKKSPackedPlaintext constructs a CKKSPackedEncoding in this context from a vector of complex numbers
:param value: input vector of complex numbers
:type value: List[complex]
:param scaleDeg: degree of scaling factor used to encode the vector
:type scaleDeg: int
:param level: level at each the vector will get encrypted
:type level: int
:param params: parameters to be used for the ciphertext (Only accepting params = None in this version)
:type params: openfhe.ParmType
:param slots: number of slots
:type slots: int
:return: plaintext
:rtype: Plaintext
)pbdoc";
const char* cc_MakeCKKSPlaintextReal_docs = R"pbdoc(
MakeCKKSPlaintext constructs a CKKSPackedEncoding in this context from a vector of real numbers
:param value: input vector (of floats)
:type value: list
:param scaleDeg: degree of scaling factor used to encode the vector
:type scaleDeg: int
:param level: level at each the vector will get encrypted
:type level: int
:param params: parameters to be used for the ciphertext (Only accepting params = None in this version)
:type params: openfhe.ParmType
:param slots: number of slots
:type slots: int
:return: plaintext
:rtype: Plaintext
)pbdoc";
const char* cc_EvalRotate_docs = R"pbdoc(
Rotates a ciphertext by an index (positive index is a left shift, negative index is a right shift). Uses a rotation key stored in a crypto context. Calls EvalAtIndex under the hood.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param index: rotation index
:type index: int
:return: a rotated ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalFastRotationPreCompute_docs = R"pbdoc(
EvalFastRotationPrecompute implements the precomputation step of hoisted automorphisms.
Please refer to Section 5 of Halevi and Shoup, "Faster Homomorphic
linear transformations in HELib." for more details, link:
https://eprint.iacr.org/2018/244.
Generally, automorphisms are performed with three steps:
(1) The automorphism is applied to the ciphertext.
(2) The automorphed values are decomposed into digits.
(3) Key switching is applied to enable further computations on the ciphertext.
Hoisted automorphisms are a technique that performs the digit decomposition for the original ciphertext first,
and then performs the automorphism and the key switching on the decomposed digits.
The benefit of this is that the digit decomposition is independent of the automorphism rotation index,
so it can be reused for multiple different indices.
This can greatly improve performance when we have to compute many automorphisms on the same ciphertext.
This routinely happens when we do permutations (EvalPermute).
EvalFastRotationPrecompute implements the digit decomposition step of hoisted automorphisms.
:param ciphertext: the input ciphertext on which to do the precomputation (digit decomposition)
:type ciphertext: Ciphertext
:return: the precomputed ciphertext created using the digit decomposition
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalFastRotation_docs = R"pbdoc(
EvalFastRotation implements the automorphism and key switching step of hoisted automorphisms.
Please refer to Section 5 of Halevi and Shoup, "Faster Homomorphic
linear transformations in HELib." for more details, link:
https://eprint.iacr.org/2018/244.
Generally, automorphisms are performed with three steps:
(1) The automorphism is applied to the ciphertext.
(2) The automorphed values are decomposed into digits.
(3) Key switching is applied to enable further computations on the ciphertext.
Hoisted automorphisms are a technique that performs the digit decomposition for the original ciphertext first,
and then performs the automorphism and the key switching on the decomposed digits.
The benefit of this is that the digit decomposition is independent of the automorphism rotation index,
so it can be reused for multiple different indices.
This can greatly improve performance when we have to compute many automorphisms on the same ciphertext.
This routinely happens when we do permutations (EvalPermute).
EvalFastRotation implements the automorphism and key switching step of hoisted automorphisms.
This method assumes that all required rotation keys exist.
This may not be true if we are using baby-step/giant-step key switching.
Please refer to Section 5.1 of the above reference and EvalPermuteBGStepHoisted to see how to deal with this issue.
:param ciphertext: the input ciphertext to perform the automorphism on
:type ciphertext: Ciphertext
:param index: the index of the rotation. Positive indices correspond to left rotations and negative indices correspond to right rotations.
:type index: int
:param m: is the cyclotomic order
:type m: int
:param digits: the precomputed ciphertext created by EvalFastRotationPrecompute using the digit decomposition at the precomputation step
:type digits: Ciphertext
:return: the rotated ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalFastRotationExt_docs = R"pbdoc(
Only supported for hybrid key switching. Performs fast (hoisted) rotation and returns the results in the extended CRT basis P*Q
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param index: the rotation index
:type index: int
:param digits: the precomputed ciphertext created by EvalFastRotationPrecompute
:type digits: Ciphertext
:param addFirst: if true, the first element c0 is also computed (otherwise ignored)
:type addFirst: bool
:return: resulting ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAtIndex_docs = R"pbdoc(
Rotates a ciphertext by an index (positive index is a left shift, negative index is a right shift). Uses a rotation key stored in a crypto context.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param i: rotation index
:type i: int
:return: a rotated ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAtIndexKeyGen_docs = R"pbdoc(
EvalAtIndexKeyGen generates evaluation keys for a list of rotation indices
:param privateKey: the private key
:type privateKey: PrivateKey
:param indexList: list of indices
:type indexList: list
:param publicKey: the public key (used in NTRU schemes). Not used anymore.
:type publicKey: PublicKey
:return: None
)pbdoc";
const char* cc_Encrypt_docs = R"doc(
Encrypt a plaintext using a given public key
:param plaintext: plaintext
:type plaintext: Plaintext
:param publicKey: public key
:type publicKey: PublicKey
:return: ciphertext (or null on failure)
:rtype: Ciphertext
)doc";
const char* cc_Decrypt_docs = R"pbdoc(
Decrypt a single ciphertext into the appropriate plaintext
:param ciphertext: ciphertext to decrypt
:type ciphertext: Ciphertext
:param privateKey: decryption key
:type privateKey: PrivateKey
:return: decrypted plaintext
:rtype: Plaintext
)pbdoc";
const char* cc_KeySwitchGen_docs = R"pbdoc(
KeySwitchGen creates a key that can be used with the OpenFHE KeySwitch operation
:param oldPrivateKey: input secrey key
:type oldPrivateKey: PrivateKey
:param newPrivateKey: output secret key
:type newPrivateKey: PrivateKey
:return: new evaluation key
:rtype: EvalKey
)pbdoc";
const char* cc_EvalAdd_docs = R"pbdoc(
Homomorphic addition of two ciphertexts
:param ciphertext1: first addend
:type ciphertext1: Ciphertext
:param ciphertext2: second addend
:type ciphertext2: Ciphertext
:return: the result as a new ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAddfloat_docs = R"pbdoc(
EvalAdd - OpenFHE EvalAdd method for a ciphertext and a real number. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param constant: a real number
:type constant: float
:return: new ciphertext for ciphertext + constant
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAddPlaintext_docs = R"pbdoc(
EvalAdd - OpenFHE EvalAdd method for a ciphertext and plaintext
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param plaintex: input plaintext
:type plaintext: Plaintext
:return: new ciphertext for ciphertext + constant
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAddInPlace_docs = R"pbdoc(
In-place homomorphic addition of two ciphertexts
:param ciphertext1: ciphertext1
:type ciphertext1: Ciphertext
:param ciphertext2: second addend
:type ciphertext2: Ciphertext
:return: ciphertext1 contains ciphertext1 + ciphertext2
)pbdoc";
const char* cc_EvalAddInPlacePlaintext_docs = R"pbdoc(
In-place addition for a ciphertext and plaintext
:param ciphertext: Input/output ciphertext
:type ciphertext: Ciphertext
:param plaintext: Input plaintext
:type plaintext: Plaintext
:return: ciphertext contains ciphertext + plaintext
)pbdoc";
const char* cc_EvalAddMutable_docs = R"pbdoc(
Homomorphic addition of two mutable ciphertexts (they can be changed during the operation)
:param ciphertext1: first addend
:type ciphertext1: Ciphertext
:param ciphertext2: second addend
:type ciphertext2: Ciphertext
:return: the result as a new ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAddMutablePlaintext_docs = R"pbdoc(
Homomorphic addition a mutable ciphertext and plaintext
:param ciphertext: ciphertext
:type ciphertext: Ciphertext
:param plaintext: plaintext
:type plaintext: Plaintext
:return: new ciphertext for ciphertext + plaintext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalAddMutableInPlace_docs = R"pbdoc(
Homomorphic addition a mutable ciphertext and plaintext
:param ciphertext1: first addend
:type ciphertext1: Ciphertext
:param ciphertext2: second addend
:type ciphertext2: Ciphertext
:return: ciphertext1 contains ciphertext1 + ciphertext2
)pbdoc";
const char* cc_EvalSub_docs = R"pbdoc(
Homomorphic subtraction of two ciphertexts
:param ciphertext1: minuend
:type ciphertext1: Ciphertext
:param ciphertext2: subtrahend
:type ciphertext2: Ciphertext
:return: the result as a new ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSubfloat_docs = R"pbdoc(
Subtraction of a ciphertext and a real number. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param constant: a real number
:type constant: float
:return: new ciphertext for ciphertext - constant
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSubPlaintext_docs = R"pbdoc(
Subtraction of a ciphertext and a real number. Supported only in CKKS.
:param ciphertext: minuend
:type ciphertext: Ciphertext
:param plaintext: subtrahend
:type plaintext: Plaintext
:return: new ciphertext for ciphertext - plaintext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSubInPlace_docs = R"pbdoc(
In-place homomorphic subtraction of two ciphertexts
:param ciphertext1: minuend
:type ciphertext1: Ciphertext
:param ciphertext2: subtrahend
:type ciphertext2: Ciphertext
:return: the result as a new ciphertext
)pbdoc";
const char* cc_EvalSubInPlacefloat_docs = R"pbdoc(
In-place subtraction of a ciphertext and a real number. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param constant: a real number
:type constant: float
)pbdoc";
// EvalSubMutable
const char* cc_EvalSubMutable_docs = R"pbdoc(
Homomorphic subtraction of two mutable ciphertexts
:param ciphertext1: minuend
:type ciphertext1: Ciphertext
:param ciphertext2: subtrahend
:type ciphertext2: Ciphertext
:return: the result as a new ciphertext
)pbdoc";
// EvalSubMutableInPlace
const char* cc_EvalSubMutableInPlace_docs = R"pbdoc(
In-place homomorphic subtraction of two mutable ciphertexts
:param ciphertext1: minuend
:type ciphertext1: Ciphertext
:param ciphertext2: subtrahend
:type ciphertext2: Ciphertext
:return: the updated minuend
)pbdoc";
// EvalSubMutablePlaintext
const char* cc_EvalSubMutablePlaintext_docs = R"pbdoc(
Homomorphic subtraction of mutable ciphertext and plaintext
:param ciphertext: minuend
:type ciphertext: Ciphertext
:param plaintext: subtrahend
:type plaintext: Plaintext
:return: new ciphertext for ciphertext - plaintext
)pbdoc";
const char* cc_EvalMult_docs = R"pbdoc(
EvalMult - OpenFHE EvalMult method for a pair of ciphertexts (uses a relinearization key from the crypto context)
:param ciphertext1: multiplier
:type ciphertext1: Ciphertext
:param ciphertext2: multiplicand
:type ciphertext2: Ciphertext
:return: new ciphertext for ciphertext1 * ciphertext2
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalMultfloat_docs = R"pbdoc(
Multiplication of a ciphertext by a real number. Supported only in CKKS.
:param ciphertext: multiplier
:type ciphertext: Ciphertext
:param constant: multiplicand
:type constant: float
:return: the result of multiplication
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalMultPlaintext_docs = R"pbdoc(
Multiplication of a ciphertext by a plaintext
:param ciphertext: multiplier
:type ciphertext: Ciphertext
:param plaintext: multiplicand
:type plaintext: Plaintext
:return: the result of multiplication
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalMultMutable_docs = R"pbdoc(
EvalMult - OpenFHE EvalMult method for a pair of mutable ciphertexts (uses a relinearization key from the crypto context)
:param ciphertext1: multiplier
:type ciphertext1: Ciphertext
:param ciphertext2: multiplicand
:type ciphertext2: Ciphertext
:return: new ciphertext for ciphertext1 * ciphertext2
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalMultMutablePlaintext_docs = R"pbdoc(
Multiplication of mutable ciphertext and plaintext
:param ciphertext: multiplier
:type ciphertext: Ciphertext
:param plaintext: multiplicand
:type plaintext: Plaintext
:return: the result of multiplication
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalMultMutableInPlace_docs = R"pbdoc(
In-place EvalMult method for a pair of mutable ciphertexts (uses a relinearization key from the crypto context)
:param ciphertext1: multiplier
:type ciphertext1: Ciphertext
:param ciphertext2: multiplicand
:type ciphertext2: Ciphertext
)pbdoc";
const char* cc_EvalSquare_docs = R"pbdoc(
Efficient homomorphic squaring of a ciphertext - uses a relinearization key stored in the crypto context
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:return: squared ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSquareMutable_docs = R"pbdoc(
Efficient homomorphic squaring of a mutable ciphertext - uses a relinearization key stored in the crypto context
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:return: squared ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSquareInPlace_docs = R"pbdoc(
In-place homomorphic squaring of a mutable ciphertext - uses a relinearization key stored in the crypto context
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:return: squared ciphertext
)pbdoc";
const char* cc_EvalMultNoRelin_docs = R"pbdoc(
Homomorphic multiplication of two ciphertexts without relinearization
:param ciphertext1: multiplier
:type ciphertext1: Ciphertext
:param ciphertext2: multiplicand
:type ciphertext2: Ciphertext
:return: new ciphertext for ciphertext1 * ciphertext2
:rtype: Ciphertext
)pbdoc";
const char* cc_Relinearize_docs = R"pbdoc(
Homomorphic multiplication of two ciphertexts withour relinearization
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:return: relinearized ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_RelinearizeInPlace_docs = R"pbdoc(
In-place relinearization of a ciphertext to the lowest level (with 2 polynomials per ciphertext).
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
)pbdoc";
const char* cc_EvalMultAndRelinearize_docs = R"pbdoc(
Homomorphic multiplication of two ciphertexts followed by relinearization to the lowest level
:param ciphertext1: first input ciphertext
:type ciphertext1: Ciphertext
:param ciphertext2: second input ciphertext
:type ciphertext2: Ciphertext
:return: new ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalNegate_docs = R"pbdoc(
Negates a ciphertext
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:return: new ciphertext: -ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalNegateInPlace_docs = R"pbdoc(
In-place negation of a ciphertext
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
)pbdoc";
const char* cc_EvalChebyshevSeries_docs = R"pbdoc(
Method for evaluating Chebyshev polynomial interpolation; first the range [a,b] is mapped to [-1,1] using linear transformation 1 + 2 (x-a)/(b-a) If the degree of the polynomial is less than 5, use EvalChebyshevSeriesLinear (naive linear method), otherwise, use EvalChebyshevSeriesPS (Paterson-Stockmeyer method). Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param coefficients: is the vector of coefficients in Chebyshev expansion
:type coefficients: list
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:return: the result of polynomial evaluation
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalChebyshevSeriesLinear_docs = R"pbdoc(
Naive linear method for evaluating Chebyshev polynomial interpolation; first the range [a,b] is mapped to [-1,1] using linear transformation 1 + 2 (x-a)/(b-a). Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param coefficients: is the vector of coefficients in Chebyshev expansion
:type coefficients: list
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:return: the result of polynomial evaluation
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalChebyshevSeriesPS_docs = R"pbdoc(
Paterson-Stockmeyer method for evaluating Chebyshev polynomial interpolation; first the range [a,b] is mapped to [-1,1] using linear transformation 1 + 2 (x-a)/(b-a). Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param coefficients: is the vector of coefficients in Chebyshev expansion
:type coefficients: list
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:return: the result of polynomial evaluation
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalChebyshevFunction_docs = R"pbdoc(
Method for calculating Chebyshev evaluation on a ciphertext for a smooth input function over the range [a,b]. Supported only in CKKS.
:param func: the function to be approximated
:type func: function
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:param degree: Desired degree of approximation
:type degree: int
:return: the coefficients of the Chebyshev approximation.
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSin_docs = R"pbdoc(
Evaluate approximate sine function on a ciphertext using the Chebyshev approximation. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:param degree: Desired degree of approximation
:type degree: int
:return: the result of polynomial evaluation.
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalCos_docs = R"pbdoc(
Evaluate approximate cosine function on a ciphertext using the Chebyshev approximation. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:param degree: Desired degree of approximation
:type degree: int
:return: the result of polynomial evaluation.
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalLogistic_docs = R"pbdoc(
Evaluate approximate logistic function 1/(1 + exp(-x)) on a ciphertext using the Chebyshev approximation. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:param degree: Desired degree of approximation
:type degree: int
:return: the result of polynomial evaluation.
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalDivide_docs = R"pbdoc(
Evaluate approximate division function 1/x where x >= 1 on a ciphertext using the Chebyshev approximation. Supported only in CKKS.
:param ciphertext: input ciphertext
:type ciphertext: Ciphertext
:param a: lower bound of argument for which the coefficients were found
:type a: float
:param b: upper bound of argument for which the coefficients were found
:type b: float
:param degree: Desired degree of approximation
:type degree: int
:return: the result of polynomial evaluation.
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSumKeyGen_docs = R"pbdoc(
EvalSumKeyGen Generates the key map to be used by EvalSum
:param privateKey: private key
:type privateKey: PrivateKey
:param publicKey: public key (used in NTRU schemes)
:type publicKey: PublicKey
:return: None
)pbdoc";
const char* cc_EvalSumRowsKeyGen_docs = R"pbdoc(
Generate the automorphism keys for EvalSumRows; works only for packed encoding
:param privateKey: private key
:type privateKey: PrivateKey
:param publicKey: public key
:type publicKey: PublicKey
:param rowSize: size of rows in the matrix
:type rowSize: int
:param subringDim: subring dimension (set to cyclotomic order if set to 0)
:type subringDim: int
:return: returns the evaluation keys
:rtype: EvalKeyMap
)pbdoc";
const char* cc_EvalSumColsKeyGen_docs = R"pbdoc(
Generates the automorphism keys for EvalSumCols; works only for packed encoding
:param privateKey: private key
:type privateKey: PrivateKey
:param publicKey: public key
:type publicKey: PublicKey
:return: returns the evaluation keys
:rtype: EvalKeyMap
)pbdoc";
const char* cc_EvalSumRows_docs = R"pbdoc(
Sums all elements over row-vectors in a matrix - works only with packed encoding
:param ciphertext: the input ciphertext
:type ciphertext: Ciphertext
:param rowSize: size of rows in the matrix
:type rowSize: int
:param evalSumKeyMap: reference to the map of evaluation keys generated by
:type evalSumKeyMap: EvalKeyMap
:param subringDim: the current cyclotomic order/subring dimension. If set to 0, we use the full cyclotomic order.
:type subringDim: int
:return: Ciphertext: resulting ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalSumCols_docs = R"pbdoc(
Sums all elements over column-vectors in a matrix - works only with packed encoding
:param ciphertext: the input ciphertext
:type ciphertext: Ciphertext
:param rowSize: size of rows in the matrix
:type rowSize: int
:param evalSumKeyMap: reference to the map of evaluation keys generated by
:type evalSumKeyMap: EvalKeyMap
:return: Ciphertext: resulting ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalInnerProduct_docs = R"pbdoc(
Evaluates inner product in packed encoding (uses EvalSum)
:param ciphertext1: first vector
:type ciphertext1: Ciphertext
:param ciphertext2: second vector
:type ciphertext2: Ciphertext
:param batchSize: size of the batch to be summed up
:type batchSize: int
:return: Ciphertext: resulting ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_EvalInnerProductPlaintext_docs = R"pbdoc(
Evaluates inner product in packed encoding (uses EvalSum)
:param ciphertext: first vector - ciphertext
:type ciphertext: Ciphertext
:param plaintext: second vector - plaintext
:type plaintext: Plaintext
:param batchSize: size of the batch to be summed up
:type batchSize: int
:return: Ciphertext: resulting ciphertext
:rtype: Ciphertext
)pbdoc";
const char* cc_MultipartyKeyGen_docs = R"pbdoc(
Threshold FHE: Generation of a public key derived from a previous joined public key (for prior secret shares) and the secret key share of the current party.
:param publicKey: joined public key from prior parties.
:type publicKey: PublicKey
:param makeSparse: set to true if ring reduce by a factor of 2 is to be used. NOT SUPPORTED BY ANY SCHEME ANYMORE.
:type makeSparse: bool
:param fresh: set to true if proxy re-encryption is used in the multi-party protocol or star topology is used
:type fresh: bool
:return: KeyPair: key pair including the secret share for the current party and joined public key
:rtype: KeyPair
)pbdoc";
const char* cc_MultipartyKeyGen_vector_docs = R"pbdoc(
Threshold FHE: Generates a public key from a vector of secret shares. ONLY FOR DEBUGGIN PURPOSES. SHOULD NOT BE USED IN PRODUCTION.
:param privateKeyVec: secret key shares.
:type privateKeyVec: List[PrivateKey]
:return KeyPair: key pair including the private for the current party and joined public key
:rtype: KeyPair
)pbdoc";
const char* cc_MultipartyDecryptLead_docs = R"pbdoc(
Threshold FHE: Method for decryption operation run by the lead decryption client
:param ciphertextVec: a list of ciphertexts
:type ciphertextVec: list
:param privateKey: secret key share used for decryption.
:type privateKey: PrivateKey
:return: list of partially decrypted ciphertexts.
:rtype: List[Ciphertext]
)pbdoc";
const char* cc_MultipartyDecryptMain_docs = R"pbdoc(
Threshold FHE: "Partial" decryption computed by all parties except for the lead one
:param ciphertextVec: a list of ciphertexts
:type ciphertextVec: list
:param privateKey: secret key share used for decryption.
:type privateKey: PrivateKey
:return: list of partially decrypted ciphertexts.
:rtype: List[Ciphertext]
)pbdoc";
const char* cc_MultipartyDecryptFusion_docs = R"pbdoc(
Threshold FHE: Method for combining the partially decrypted ciphertexts and getting the final decryption in the clear.
:param partialCiphertextVec: list of "partial" decryptions
:type partialCiphertextVec: list
:return: Plaintext: resulting plaintext
:rtype: Plaintext
)pbdoc";
const char* cc_MultiKeySwitchGen_docs = R"pbdoc(
Threshold FHE: Generates a joined evaluation key from the current secret share and a prior joined evaluation key
:param originalPrivateKey: secret key transformed from.
:type originalPrivateKey: PrivateKey
:param newPrivateKey: secret key transformed from.
:type newPrivateKey: PrivateKey
:param evalKey: the prior joined evaluation key.
:type evalKey: EvalKey
:return: EvalKey: the new joined evaluation key.
:rtype: EvalKey
)pbdoc";
const char* cc_GetEvalAutomorphismKeyMap_docs = R"pbdoc(
Get automorphism keys for a specific secret key tag
:param keyId: key identifier used for private key
:type keyId: str
:return: EvalKeyMap: map with all automorphism keys.
:rtype: EvalKeyMap
)pbdoc";
// TODO (Oliveira, R.) - Complete the following documentation
const char* cc_GetEvalSumKeyMap_docs = R"pbdoc(
Get a map of summation keys (each is composed of several automorphism keys) for a specific secret key tag
:return: EvalKeyMap: key map
:rtype: EvalKeyMap
)pbdoc";
const char* cc_InsertEvalSumKey_docs = R"pbdoc(
InsertEvalSumKey - add the given map of keys to the map, replacing the existing map if there
:param evalKeyMap: key map
:type evalKeyMap: EvalKeyMap
)pbdoc";
const char* cc_MultiEvalAtIndexKeyGen_docs = R"pbdoc(
Threshold FHE: Generates joined rotation keys from the current secret key and prior joined rotation keys
:param privateKey: secret key share
:type privateKey: PrivateKey
:param evalKeyMap: a map with prior joined rotation keys
:type evalKeyMap: EvalKeyMap
:param indexList: a vector of rotation indices
:type indexList: List[int32]
:param keyId: new key identifier used for resulting evaluation key
:type keyId: str
:return: EvalKeyMap: new joined rotation keys
:rtype: EvalKeyMap
)pbdoc";
const char* cc_MultiEvalSumKeyGen_docs = R"pbdoc(
Threshold FHE: Generates joined summation evaluation keys from the current secret share and prior joined summation keys
:param privateKey: secret key share
:type privateKey: PrivateKey
:param evalKeyMap: a map with prior joined summation keys
:type evalKeyMap: EvalKeyMap
:param keyId: new key identifier used for resulting evaluation key
:type keyId: str
:return: EvalKeyMap: new joined summation keys
:rtype: EvalKeyMap
)pbdoc";
const char* cc_MultiAddEvalAutomorphismKeys_docs = R"pbdoc(
Threshold FHE: Adds two prior evaluation key sets for automorphisms
:param evalKeyMap1: first automorphism key set
:type evalKeyMap1: EvalKeyMap
:param evalKeyMap2: second automorphism key set
:type evalKeyMap2: EvalKeyMap
:param keyId: new key identifier used for resulting evaluation key
:type keyId: str
:return: the new joined key set for summation
:rtype: evalKeyMap
)pbdoc";