0
當編譯密碼庫時,我得到一個錯誤問題編譯加密庫
crypto/ope.cpp: In member function ‘NTL::ZZ OPE::encrypt(const NTL::ZZ&, int)’:
crypto/ope.cpp:80: error: expected primary-expression before ‘[’ token
crypto/ope.cpp:80: error: expected primary-expression before ‘const’
crypto/ope.cpp:80: error: expected primary-expression before ‘const’
crypto/ope.cpp: In member function ‘NTL::ZZ OPE::decrypt(const NTL::ZZ&)’:
crypto/ope.cpp:110: error: expected primary-expression before ‘[’ token
crypto/ope.cpp:110: error: expected primary-expression before ‘const’
crypto/ope.cpp:110: error: expected primary-expression before ‘const’
的代碼片段如下:
template<class CB>
ope_domain_range
OPE::search(CB go_low)
{
blockrng<AES> r(aesk);
return lazy_sample(to_ZZ(0), to_ZZ(1) << pbits,
to_ZZ(0), to_ZZ(1) << cbits,
go_low, &r);
}
ZZ
OPE::encrypt(const ZZ &ptext, int offset)
{
ope_domain_range dr =
search([&ptext](const ZZ &d, const ZZ &) { return ptext < d; });
blockrng<AES> aesrand(aesk);
auto v = sha256::hash(StringFromZZ(ptext));
v.resize(16);
aesrand.set_ctr(v);
ZZ nrange = dr.r_hi - dr.r_lo + 1;
if (nrange < 4 || det)
return dr.r_lo + aesrand.rand_zz_mod(nrange);
ZZ nrquad = nrange/4;
static urandom urand;
switch (offset) {
case -1:
return dr.r_lo + urand.rand_zz_mod(nrquad);
case 0:
return dr.r_lo + nrquad + urand.rand_zz_mod(nrquad * 2);
case 1:
return dr.r_lo + nrquad * 3 + urand.rand_zz_mod(nrquad);
default:
assert(0);
}
}
80號線的代碼是(那些上線110是類似的):
ope_domain_range dr =
search([&ptext](const ZZ &d, const ZZ &) { return ptext < d; });
我不太熟悉新的C++標準C++ 11。這是新標準新引入的嗎? 如果不是,那是什麼意思? 如果是,我可以使用g ++版本4.4.7編譯C++ 11代碼嗎? (目前我編譯的庫以g ++ 4.4.7標記爲-std = C++ 0x。)
非常感謝。
非常感謝! –