-rw-r--r-- 825 cryptattacktester-20230614/predictedcp.cpp raw
#include <iostream> #include "problem.h" #include "attack.h" using namespace std; int attack_handle(const problem &E,const vector<bigint> &P,const attack &A,const vector<bigint> &Q) { bigint cost = A.cost(P,Q); bigfloat prob = A.prob(P,Q); bigfloat lgcost = log2(bigfloat(cost)); bigfloat lgprob = log2(prob); cout << "predictedcp"; cout << " problem=" << E.name; for (bigint j = 0;j < P.size();++j) cout << (j ? ',' : ' ') << E.paramnames.at(j) << "=" << P.at(j); cout << " attack=" << A.name; for (bigint j = 0;j < Q.size();++j) cout << (j ? ',' : ' ') << A.paramnames.at(j) << "=" << Q.at(j); cout << " lgratio " << lgcost-lgprob; cout << " cost " << cost; cout << " lgcost " << lgcost; cout << " prob " << prob; cout << " lgprob " << lgprob; cout << '\n' << flush; return 1; }