Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
PALISADE
PALISADE Development
Commits
e649dda7
Commit
e649dda7
authored
Jan 23, 2018
by
Jerry Ryan
Browse files
ildcrtparams for everyone
parent
93df7cda
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
46 additions
and
38 deletions
+46
-38
benchmark/src/Lattice.cpp
benchmark/src/Lattice.cpp
+5
-0
src/core/lib/lattice/elemparamfactory.h
src/core/lib/lattice/elemparamfactory.h
+9
-9
src/core/lib/lattice/ildcrtparams.h
src/core/lib/lattice/ildcrtparams.h
+1
-0
src/core/lib/lattice/ilparams.h
src/core/lib/lattice/ilparams.h
+1
-0
src/core/lib/utils/parmfactory.h
src/core/lib/utils/parmfactory.h
+4
-3
src/core/unittest/UnitTestEncoding.cpp
src/core/unittest/UnitTestEncoding.cpp
+5
-5
src/core/unittest/UnitTestLatticeElements.cpp
src/core/unittest/UnitTestLatticeElements.cpp
+5
-5
src/core/unittest/UnitTestSerialize.cpp
src/core/unittest/UnitTestSerialize.cpp
+2
-2
src/pke/lib/cryptocontextgen.h
src/pke/lib/cryptocontextgen.h
+4
-4
src/pke/lib/cryptocontexthelper-impl.cpp
src/pke/lib/cryptocontexthelper-impl.cpp
+1
-1
src/pke/unittest/UnitTestBVDCRT.cpp
src/pke/unittest/UnitTestBVDCRT.cpp
+1
-1
src/pke/unittest/UnitTestSHE.cpp
src/pke/unittest/UnitTestSHE.cpp
+5
-5
src/pke/unittest/UnitTestSHEAdvanced.cpp
src/pke/unittest/UnitTestSHEAdvanced.cpp
+3
-3
No files found.
benchmark/src/Lattice.cpp
View file @
e649dda7
...
...
@@ -205,6 +205,11 @@ public:
GeneratePolys
<
BE2ILDCRTParams
,
BE2DCRTPoly
>
(
BE2dcrtparms
,
BE2DCRTpolys
);
GeneratePolys
<
BE4ILDCRTParams
,
BE4DCRTPoly
>
(
BE4dcrtparms
,
BE4DCRTpolys
);
GeneratePolys
<
BE6ILDCRTParams
,
BE6DCRTPoly
>
(
BE6dcrtparms
,
BE6DCRTpolys
);
cout
<<
*
BE2dcrtparms
[
16
]
<<
endl
;
cout
<<
*
BE4dcrtparms
[
16
]
<<
endl
;
cout
<<
*
BE6dcrtparms
[
16
]
<<
endl
;
cout
<<
BE6DCRTpolys
[
16
][
0
]
<<
endl
;
}
template
<
typename
P
>
...
...
src/core/lib/lattice/elemparamfactory.h
View file @
e649dda7
...
...
@@ -79,7 +79,7 @@ public:
* @param m - order
* @return new params
*/
template
<
typename
P
,
typename
I
>
template
<
typename
P
>
static
shared_ptr
<
P
>
GenElemParams
(
usint
m
)
{
size_t
sIdx
=
0
;
if
(
DefaultSet
[
0
].
m
<
m
)
{
...
...
@@ -91,7 +91,7 @@ public:
if
(
DefaultSet
[
sIdx
].
m
==
0
)
sIdx
--
;
return
shared_ptr
<
P
>
(
new
P
(
DefaultSet
[
sIdx
].
m
,
I
(
DefaultSet
[
sIdx
].
q
),
I
(
DefaultSet
[
sIdx
].
ru
))
);
return
shared_ptr
<
P
>
(
new
P
(
DefaultSet
[
sIdx
].
m
,
typename
P
::
Integer
(
DefaultSet
[
sIdx
].
q
),
typename
P
::
Integer
(
DefaultSet
[
sIdx
].
ru
))
);
}
/**
...
...
@@ -102,10 +102,10 @@ public:
* @param bits # of bits in q
* @return new params
*/
template
<
typename
P
,
typename
I
>
template
<
typename
P
>
static
shared_ptr
<
P
>
GenElemParams
(
usint
m
,
usint
bits
,
usint
towersize
=
0
)
{
I
q
=
FirstPrime
<
I
>
(
bits
,
m
);
I
ru
=
RootOfUnity
<
I
>
(
m
,
q
);
typename
P
::
Integer
q
=
FirstPrime
<
typename
P
::
Integer
>
(
bits
,
m
);
typename
P
::
Integer
ru
=
RootOfUnity
<
typename
P
::
Integer
>
(
m
,
q
);
return
shared_ptr
<
P
>
(
new
P
(
m
,
q
,
ru
)
);
}
...
...
@@ -117,16 +117,16 @@ public:
* @param rootUnity - root of unity
* @return
*/
template
<
typename
P
,
typename
I
>
static
shared_ptr
<
P
>
GenElemParams
(
usint
m
,
const
I
&
ctModulus
,
const
I
&
rootUnity
)
{
template
<
typename
P
>
static
shared_ptr
<
P
>
GenElemParams
(
usint
m
,
const
typename
P
::
Integer
&
ctModulus
,
const
typename
P
::
Integer
&
rootUnity
)
{
return
shared_ptr
<
P
>
(
new
P
(
m
,
ctModulus
,
rootUnity
)
);
}
};
template
<
>
inline
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
ElemParamFactory
::
GenElemParams
<
ILDCRTParams
<
BigInteger
>
,
BigInteger
>
(
usint
m
,
usint
bits
,
usint
towersize
)
{
return
GenerateDCRTParams
(
m
,
towersize
,
bits
);
ElemParamFactory
::
GenElemParams
<
ILDCRTParams
<
BigInteger
>>
(
usint
m
,
usint
bits
,
usint
towersize
)
{
return
GenerateDCRTParams
<
BigInteger
>
(
m
,
towersize
,
bits
);
}
}
/* namespace lbcrypto */
...
...
src/core/lib/lattice/ildcrtparams.h
View file @
e649dda7
...
...
@@ -53,6 +53,7 @@ template<typename IntType>
class
ILDCRTParams
:
public
ElemParams
<
IntType
>
{
public:
typedef
IntType
Integer
;
/**
* @brief Constructor with basic parameter set.
...
...
src/core/lib/lattice/ilparams.h
View file @
e649dda7
...
...
@@ -51,6 +51,7 @@ template<typename IntType>
class
ILParamsImpl
:
public
ElemParams
<
IntType
>
{
public:
typedef
IntType
Integer
;
/**
* Constructor that initializes nothing.
...
...
src/core/lib/utils/parmfactory.h
View file @
e649dda7
...
...
@@ -50,7 +50,8 @@ using namespace lbcrypto;
* @param pbits - number of bits in the prime, to start with
* @return
*/
inline
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
GenerateDCRTParams
(
usint
m
,
usint
numOfTower
,
usint
pbits
)
{
template
<
typename
I
>
inline
shared_ptr
<
ILDCRTParams
<
I
>>
GenerateDCRTParams
(
usint
m
,
usint
numOfTower
,
usint
pbits
)
{
if
(
numOfTower
==
0
)
throw
std
::
logic_error
(
"Can't make parms with numOfTower == 0 "
);
...
...
@@ -59,7 +60,7 @@ inline shared_ptr<ILDCRTParams<BigInteger>> GenerateDCRTParams(usint m, usint nu
std
::
vector
<
NativeInteger
>
rootsOfUnity
(
numOfTower
);
NativeInteger
q
=
FirstPrime
<
NativeInteger
>
(
pbits
,
m
);
BigInteger
modulus
(
1
);
I
modulus
(
1
);
usint
j
=
0
;
for
(;;)
{
...
...
@@ -72,7 +73,7 @@ inline shared_ptr<ILDCRTParams<BigInteger>> GenerateDCRTParams(usint m, usint nu
q
=
NextPrime
(
q
,
m
);
}
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
(
new
ILDCRTParams
<
BigInteger
>
(
m
,
moduli
,
rootsOfUnity
));
shared_ptr
<
ILDCRTParams
<
I
>>
params
(
new
ILDCRTParams
<
I
>
(
m
,
moduli
,
rootsOfUnity
));
return
params
;
}
...
...
src/core/unittest/UnitTestEncoding.cpp
View file @
e649dda7
...
...
@@ -59,7 +59,7 @@ TEST_F(UTEncoding,scalar_encoding) {
usint
m
=
8
;
PlaintextModulus
ptm
=
128
;
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
,
BigInteger
>
(
m
);
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
BigInteger
>
>
(
m
);
EncodingParams
ep
(
new
EncodingParamsImpl
(
ptm
)
);
ScalarEncoding
se
(
lp
,
ep
,
value
);
...
...
@@ -96,7 +96,7 @@ TEST_F(UTEncoding,coef_packed_encoding) {
vector
<
int64_t
>
value
=
{
32
,
17
,
8
,
-
12
,
-
32
,
22
,
-
101
,
6
};
usint
m
=
16
;
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
,
BigInteger
>
(
m
);
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
BigInteger
>
>
(
m
);
EncodingParams
ep
(
new
EncodingParamsImpl
(
256
)
);
CoefPackedEncoding
se
(
lp
,
ep
,
value
);
...
...
@@ -134,7 +134,7 @@ TEST_F(UTEncoding,string_encoding) {
usint
m
=
64
;
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
,
BigInteger
>
(
m
);
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
BigInteger
>
>
(
m
);
EncodingParams
ep
(
new
EncodingParamsImpl
(
256
)
);
StringEncoding
se
(
lp
,
ep
,
value
);
se
.
Encode
();
...
...
@@ -143,7 +143,7 @@ TEST_F(UTEncoding,string_encoding) {
// truncate!
shared_ptr
<
ILParams
>
lp2
=
ElemParamFactory
::
GenElemParams
<
ILParams
,
BigInteger
>
(
4
);
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
BigInteger
>
>
(
4
);
StringEncoding
se2
(
lp2
,
ep
,
value
);
se2
.
Encode
();
se2
.
Decode
();
...
...
@@ -153,7 +153,7 @@ TEST_F(UTEncoding,string_encoding) {
TEST_F
(
UTEncoding
,
integer_encoding
){
int
m
=
64
;
PlaintextModulus
ptm
=
((
uint64_t
)
1
<<
30
);
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
,
BigInteger
>
(
m
);
shared_ptr
<
ILParams
>
lp
=
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
BigInteger
>
>
(
m
);
EncodingParams
ep
(
new
EncodingParamsImpl
(
ptm
)
);
int64_t
mv
=
((
uint64_t
)
1
<<
20
)
+
(
uint64_t
)
1
;
...
...
src/core/unittest/UnitTestLatticeElements.cpp
View file @
e649dda7
...
...
@@ -160,7 +160,7 @@ TEST(UTPoly, ops_tests) {
Poly
::
Integer
primitiveRootOfUnity
(
"22"
);
operators_tests
<
BigInteger
,
BigVector
,
ILParams
,
Poly
>
(
ElemParamFactory
::
GenElemParams
<
ILParams
,
BigInteger
>
(
m
)
);
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
BigInteger
>
>
(
m
)
);
}
TEST
(
UTNativePoly
,
ops_tests
)
{
...
...
@@ -169,12 +169,12 @@ TEST(UTNativePoly, ops_tests) {
NativeInteger
primitiveRootOfUnity
(
"22"
);
operators_tests
<
NativeInteger
,
NativeVector
,
ILNativeParams
,
NativePoly
>
(
ElemParamFactory
::
GenElemParams
<
IL
Native
Params
,
NativeInteger
>
(
m
)
);
ElemParamFactory
::
GenElemParams
<
ILParams
Impl
<
NativeInteger
>
>
(
m
)
);
}
TEST
(
UTDCRTPoly
,
ops_tests
)
{
operators_tests
<
BigInteger
,
BigVector
,
ILDCRTParams
<
BigInteger
>
,
DCRTPoly
>
(
GenerateDCRTParams
(
8
,
3
,
20
)
);
GenerateDCRTParams
<
BigInteger
>
(
8
,
3
,
20
)
);
}
// template for rounding_operations tests
...
...
@@ -1479,7 +1479,7 @@ TEST(UTDCRTPoly, decompose_test) {
float
stdDev
=
4
;
DCRTPoly
::
DggType
dgg
(
stdDev
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
(
order
,
towersize
,
nBits
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
<
BigInteger
>
(
order
,
towersize
,
nBits
);
DCRTPoly
DCRTPolyFirst
(
dgg
,
params
,
Format
::
COEFFICIENT
);
DCRTPoly
DCRTPolyOriginal
(
DCRTPolyFirst
);
...
...
@@ -1554,7 +1554,7 @@ TEST(UTDCRTPoly, ensures_mod_operation_during_ops_on_two_DCRTPolys){
usint
nBits
=
24
;
usint
towersize
=
3
;
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
ildcrtparams
=
GenerateDCRTParams
(
order
,
towersize
,
nBits
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
ildcrtparams
=
GenerateDCRTParams
<
BigInteger
>
(
order
,
towersize
,
nBits
);
DCRTPoly
::
DugType
dug
;
...
...
src/core/unittest/UnitTestSerialize.cpp
View file @
e649dda7
...
...
@@ -201,7 +201,7 @@ TEST(UTSer,ilparams_test) {
TEST
(
UTSer
,
ildcrtparams_test
)
{
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
p
=
GenerateDCRTParams
(
1024
,
5
,
30
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
p
=
GenerateDCRTParams
<
BigInteger
>
(
1024
,
5
,
30
);
Serialized
ser
;
ser
.
SetObject
();
ASSERT_TRUE
(
p
->
Serialize
(
&
ser
)
)
<<
"Serialization failed"
;
...
...
@@ -229,7 +229,7 @@ TEST(UTSer,ilvector_test) {
}
TEST
(
UTSer
,
ildcrtpoly_test
)
{
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
p
=
GenerateDCRTParams
(
1024
,
5
,
30
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
p
=
GenerateDCRTParams
<
BigInteger
>
(
1024
,
5
,
30
);
DCRTPoly
::
DugType
dug
;
DCRTPoly
vec
(
dug
,
p
);
...
...
src/pke/lib/cryptocontextgen.h
View file @
e649dda7
...
...
@@ -41,7 +41,7 @@ static const usint DefaultT = 3;
template
<
typename
Element
>
inline
CryptoContext
<
Element
>
GenCryptoContextNull
(
usint
ORDER
,
PlaintextModulus
ptm
,
usint
bits
=
DefaultQbits
,
usint
towers
=
DefaultT
)
{
shared_ptr
<
typename
Element
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Element
::
Params
,
typename
Element
::
Integer
>
(
ORDER
,
bits
,
towers
);
shared_ptr
<
typename
Element
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Element
::
Params
>
(
ORDER
,
bits
,
towers
);
CryptoContext
<
Element
>
cc
=
CryptoContextFactory
<
Element
>::
genCryptoContextNull
(
ORDER
,
ptm
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -54,7 +54,7 @@ GenCryptoContextNull(usint ORDER, PlaintextModulus ptm, usint bits=DefaultQbits,
template
<
typename
Element
>
inline
CryptoContext
<
Element
>
GenCryptoContextLTV
(
usint
ORDER
,
PlaintextModulus
ptm
,
usint
bits
=
DefaultQbits
,
usint
towers
=
DefaultT
)
{
shared_ptr
<
typename
Element
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Element
::
Params
,
typename
Element
::
Integer
>
(
ORDER
,
bits
,
towers
);
shared_ptr
<
typename
Element
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Element
::
Params
>
(
ORDER
,
bits
,
towers
);
CryptoContext
<
Element
>
cc
=
CryptoContextFactory
<
Element
>::
genCryptoContextLTV
(
p
,
ptm
,
1
,
4
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -100,7 +100,7 @@ template<>
inline
CryptoContext
<
Poly
>
GenCryptoContextBFV
(
usint
ORDER
,
PlaintextModulus
ptm
,
usint
bits
,
usint
towers
,
MODE
mode
)
{
shared_ptr
<
typename
Poly
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Poly
::
Params
,
typename
Poly
::
Integer
>
(
ORDER
,
bits
,
towers
);
shared_ptr
<
typename
Poly
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Poly
::
Params
>
(
ORDER
,
bits
,
towers
);
CryptoContext
<
Poly
>
cc
=
CryptoContextFactory
<
Poly
>::
genCryptoContextBFV
(
ptm
,
1.006
,
1
,
4
,
0
,
2
,
0
,
mode
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -159,7 +159,7 @@ GenCryptoContextBFVrns(PlaintextModulus ptm, MODE mode) {
template
<
typename
Element
>
inline
CryptoContext
<
Element
>
GenTestCryptoContext
(
const
string
&
name
,
usint
ORDER
,
PlaintextModulus
ptm
,
usint
bits
=
DefaultQbits
,
usint
towers
=
DefaultT
)
{
shared_ptr
<
typename
Element
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Element
::
Params
,
typename
Element
::
Integer
>
(
ORDER
,
bits
,
towers
);
shared_ptr
<
typename
Element
::
Params
>
p
=
ElemParamFactory
::
GenElemParams
<
typename
Element
::
Params
>
(
ORDER
,
bits
,
towers
);
CryptoContext
<
Element
>
cc
;
if
(
name
==
"Null"
)
{
...
...
src/pke/lib/cryptocontexthelper-impl.cpp
View file @
e649dda7
...
...
@@ -282,7 +282,7 @@ CryptoContextHelper::getNewDCRTContext(const string& parmset, usint numTowers, u
return
0
;
}
parms
=
GenerateDCRTParams
(
stoul
(
ring
),
numTowers
,
primeBits
);
parms
=
GenerateDCRTParams
<
DCRTPoly
::
Integer
>
(
stoul
(
ring
),
numTowers
,
primeBits
);
}
return
buildContextFromSerialized
<
DCRTPoly
>
(
it
->
second
,
parms
);
...
...
src/pke/unittest/UnitTestBVDCRT.cpp
View file @
e649dda7
...
...
@@ -63,7 +63,7 @@ TEST_F(UTBGVDCRT, Poly_bgv_DCRT_MODREDUCE) {
float
stdDev
=
4
;
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
(
m
,
numOfTower
,
48
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
<
BigInteger
>
(
m
,
numOfTower
,
48
);
CryptoContext
<
DCRTPoly
>
cc
=
CryptoContextFactory
<
DCRTPoly
>::
genCryptoContextBGV
(
params
,
plaintextModulus
,
m
,
stdDev
);
cc
->
Enable
(
ENCRYPTION
);
...
...
src/pke/unittest/UnitTestSHE.cpp
View file @
e649dda7
...
...
@@ -262,7 +262,7 @@ TEST_F(UTSHE, keyswitch_SingleCRT) {
float
stdDev
=
4
;
shared_ptr
<
Poly
::
Params
>
params
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
,
Poly
::
Integer
>
(
m
,
50
);
shared_ptr
<
Poly
::
Params
>
params
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
>
(
m
,
50
);
CryptoContext
<
Poly
>
cc
=
CryptoContextFactory
<
Poly
>::
genCryptoContextLTV
(
params
,
256
,
1
,
stdDev
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -295,7 +295,7 @@ TEST_F(UTSHE, sparsekeygen_single_crt_encrypt_decrypt) {
float
stdDev
=
4
;
shared_ptr
<
Poly
::
Params
>
params
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
,
Poly
::
Integer
>
(
m
);
shared_ptr
<
Poly
::
Params
>
params
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
>
(
m
);
CryptoContext
<
Poly
>
cc
=
CryptoContextFactory
<
Poly
>::
genCryptoContextLTV
(
params
,
256
,
1
,
stdDev
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -332,7 +332,7 @@ TEST_F(UTSHE, keyswitch_ModReduce_DCRT) {
usint
plaintextmodulus
=
256
;
usint
relinWindow
=
1
;
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
(
m
,
size
,
30
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
<
BigInteger
>
(
m
,
size
,
30
);
CryptoContext
<
DCRTPoly
>
cc
=
CryptoContextFactory
<
DCRTPoly
>::
genCryptoContextLTV
(
params
,
plaintextmodulus
,
relinWindow
,
stdDev
);
...
...
@@ -380,7 +380,7 @@ TEST_F(UTSHE, ringreduce_single_crt) {
float
stdDev
=
4
;
shared_ptr
<
Poly
::
Params
>
params
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
,
Poly
::
Integer
>
(
m
);
shared_ptr
<
Poly
::
Params
>
params
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
>
(
m
);
CryptoContext
<
Poly
>
cc
=
CryptoContextFactory
<
Poly
>::
genCryptoContextLTV
(
params
,
2
,
1
,
stdDev
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -431,7 +431,7 @@ TEST_F(UTSHE, ringreduce_double_crt) {
usint
relinWindow
=
1
;
usint
size
=
3
;
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
(
m
,
size
,
30
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
<
BigInteger
>
(
m
,
size
,
30
);
CryptoContext
<
DCRTPoly
>
cc
=
CryptoContextFactory
<
DCRTPoly
>::
genCryptoContextLTV
(
params
,
plaintextmodulus
,
relinWindow
,
stdDev
);
cc
->
Enable
(
ENCRYPTION
);
...
...
src/pke/unittest/UnitTestSHEAdvanced.cpp
View file @
e649dda7
...
...
@@ -69,7 +69,7 @@ TEST_F(UTSHEAdvanced, test_eval_mult_single_crt) {
float
stdDev
=
4
;
PlaintextModulus
ptm
=
20
;
shared_ptr
<
Poly
::
Params
>
parms
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
,
Poly
::
Integer
>
(
m
,
50
);
shared_ptr
<
Poly
::
Params
>
parms
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
>
(
m
,
50
);
CryptoContext
<
Poly
>
cc
=
CryptoContextFactory
<
Poly
>::
genCryptoContextLTV
(
parms
,
ptm
,
relin
,
stdDev
);
cc
->
Enable
(
ENCRYPTION
);
...
...
@@ -190,7 +190,7 @@ TEST_F(UTSHEAdvanced, test_eval_add_single_crt) {
float
stdDev
=
4
;
shared_ptr
<
Poly
::
Params
>
parms
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
,
Poly
::
Integer
>
(
m
);
shared_ptr
<
Poly
::
Params
>
parms
=
ElemParamFactory
::
GenElemParams
<
Poly
::
Params
>
(
m
);
CryptoContext
<
Poly
>
cc
=
CryptoContextFactory
<
Poly
>::
genCryptoContextLTV
(
parms
,
ptm
,
1
,
stdDev
);
...
...
@@ -317,7 +317,7 @@ TEST_F(UTSHEAdvanced, test_composed_eval_mult_two_towers) {
PlaintextModulus
ptm
=
16
;
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
(
init_m
,
init_size
,
dcrtBits
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
params
=
GenerateDCRTParams
<
BigInteger
>
(
init_m
,
init_size
,
dcrtBits
);
shared_ptr
<
ILDCRTParams
<
BigInteger
>>
paramsSmall
(
new
ILDCRTParams
<
BigInteger
>
(
*
params
)
);
paramsSmall
->
PopLastParam
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment