本文整理汇总了C++中Bank::request_from_client方法的典型用法代码示例。如果您正苦于以下问题:C++ Bank::request_from_client方法的具体用法?C++ Bank::request_from_client怎么用?C++ Bank::request_from_client使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bank
的用法示例。
在下文中一共展示了Bank::request_from_client方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_banknote
void get_banknote(Bank& bank, int num, Store& store)
{
string mas[9] = {"1 рубль", "2 рубля", "5 рублей", "10 рублей",
"50 рублей", "100 рублей", "500 рублей", "1000 рублей", "5000 рублей"};
static set<long int> used_n;
//static long int used_nn;
long int n = 0;
while (1) {
n = 2 + rand() % (N_cl - 1);
// used_nn = n;
// break;
if (used_n.count(n) != 1) {
used_n.insert(n);
break;
}
}
long int hash = MD5_Hash(N_cl, n);
cout << "Для "<< mas[num] <<":\n";
cout << "[*] n = " << n << endl;
long int r;
while (result.gcd != 1) {
r = get_number_range(1, N_cl - 1);
Evclid(r, N_cl);
}
cout << "[*] r = " << r << endl;
long int tmp_n, tmp_s;
//cout << d_cl[num] << endl;
tmp_n = (hash * (MyPow(r, d_cl[num], N_cl))) % N_cl;
tmp_s = bank.request_from_client(tmp_n, num);
cout << "[*] tmp_n = " << tmp_n << endl;
cout << "[*] tmp_s = " << tmp_s << endl;
Evclid(r, N_cl);
if (result.x < 0) {
r = N_cl + result.x;
} else {
r = result.x;
}
long int s = (tmp_s * r) % N_cl;
cout << "[*] s = " << s << '\n' << endl;
if (store.check_sign(n, s, bank)) {
cout << "\nПокупка совершенна" << endl;
} else {
cout << "\nОшибка" << endl;
}
cout << "===========================================" << endl;
}