BP3 P1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
usint plaintextModulus = 536903681; | |
double sigma = 3.2; | |
size_t batchSize = 8; | |
SecurityLevel securityLevel = HEStd_128_classic; | |
//////////////////////////////////////////////////////////// | |
// Parameter generation | |
//////////////////////////////////////////////////////////// | |
EncodingParams encodingParams(new EncodingParamsImpl(plaintextModulus, batchSize)); | |
//Set Crypto Parameters | |
// # of evalMults = 3 (first 3) is used to support the multiplication of 7 ciphertexts, i.e., ceiling{log2{7}} | |
// Max depth is set to 3 (second 3) to generate homomorphic evaluation multiplication keys for s^2 and s^3 | |
CryptoContext<DCRTPoly> cc = CryptoContextFactory<DCRTPoly>::genCryptoContextBFVrns(encodingParams, securityLevel, sigma, 0, 3, 0, OPTIMIZED, 3); | |
// enable features that you wish to use | |
cc->Enable(ENCRYPTION); | |
cc->Enable(SHE); | |
// Generating a secret-public keypair | |
LPKeyPair<DCRTPoly> kp = cc->KeyGen(); | |
if( !kp.good() ) { | |
std::cout << "Key generation failed!" << std::endl; | |
exit(1); | |
} | |
usint m = cc->GetCryptoParameters()->GetElementParams()->GetCyclotomicOrder(); | |
PackedEncoding::SetParams(m, encodingParams); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment