本文整理汇总了C++中Measurement::begin_with_init方法的典型用法代码示例。如果您正苦于以下问题:C++ Measurement::begin_with_init方法的具体用法?C++ Measurement::begin_with_init怎么用?C++ Measurement::begin_with_init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Measurement
的用法示例。
在下文中一共展示了Measurement::begin_with_init方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_rand_gen
double do_rand_gen(int size_input, mpz_t *vec, mpz_t prime) {
Measurement m;
m.begin_with_init();
crypto->get_random_vec_priv(size_input, vec, prime);
m.end();
return m.get_ru_elapsed_time();
}
示例2: do_decrypt
double do_decrypt(int size_input, mpz_t *plain, mpz_t *cipher,
int prime_size, mpz_t prime) {
Measurement m;
m.begin_with_init();
for (int i=0; i<size_input; i++)
crypto->elgamal_dec(plain[i], cipher[2*i], cipher[2*i+1]);
m.end();
return m.get_ru_elapsed_time();
}
示例3: do_encrypt
// ======== cost of ciphertext operations ======
double do_encrypt(int size_input, mpz_t *plain, mpz_t *cipher,
int prime_size, mpz_t prime) {
Measurement m;
crypto->get_random_vec_priv(size_input, plain, prime);
m.begin_with_init();
for (int i=0; i<size_input; i++)
crypto->elgamal_enc(cipher[2*i], cipher[2*i+1], plain[i]);
m.end();
return m.get_ru_elapsed_time();
}
示例4: do_regular_ciphermul
double do_regular_ciphermul(int size_input, mpz_t *plain, mpz_t *cipher,
int prime_size, mpz_t prime) {
mpz_t out1, out2;
alloc_init_scalar(out1);
alloc_init_scalar(out2);
Measurement m;
m.begin_with_init();
crypto->dot_product_regular_enc(size_input, cipher, plain, out1, out2);
m.end();
clear_scalar(out1);
clear_scalar(out2);
return m.get_ru_elapsed_time();
}
示例5: do_div
double do_div(int size_input, mpz_t *vec1,
mpz_t *vec2, mpz_t *vec3, int operand_size1, int operand_size2,
mpz_t prime) {
Measurement m;
crypto->get_random_vec_priv(size_input, vec1, operand_size1);
crypto->get_random_vec_priv(size_input, vec2, operand_size2);
m.begin_with_init();
for (int i=0; i<size_input; i++) {
mpz_invert(vec3[i], vec2[i], prime);
mpz_mul(vec3[i], vec3[i], vec1[i]);
mpz_mod(vec3[i], vec3[i], prime);
}
m.end();
return m.get_ru_elapsed_time();
}
示例6: do_field_mult
// ======== cost of plaintext operations =========
double do_field_mult(int size_input, mpz_t *vec1,
mpz_t *vec2, mpz_t *vec3, mpz_t prime) {
Measurement m;
crypto->get_random_vec_priv(size_input, vec1, prime);
crypto->get_random_vec_priv(size_input, vec2, prime);
m.begin_with_init();
for (int i=0; i<size_input; i++) {
mpz_mul(vec3[i], vec1[i], vec2[i]);
mpz_mod(vec3[i], vec3[i], prime);
}
for (int i=0; i<size_input; i++) {
mpz_add(vec3[i], vec1[i], vec2[i]);
mpz_mod(vec3[i], vec3[i], prime);
}
m.end();
return m.get_ru_elapsed_time();
}