@@ -77,6 +77,11 @@ void CreateAndWriteProofTwoWeso(integer& D, form f, uint64_t iters, TwoWesolowsk
77
77
WriteProof (iters, result, sock);
78
78
}
79
79
80
+ form initial_form;
81
+ char form_size[10 ];
82
+ char form_a[10000 ];
83
+ char form_b[10000 ];
84
+
80
85
void InitSession (tcp::socket& sock) {
81
86
boost::system::error_code error;
82
87
@@ -87,6 +92,24 @@ void InitSession(tcp::socket& sock) {
87
92
disc_int_size = atoi (disc_size);
88
93
boost::asio::read (sock, boost::asio::buffer (disc, disc_int_size), error);
89
94
95
+ boost::asio::read (sock, boost::asio::buffer (disc_size, 3 ), error);
96
+ char prefix_len[3 ];
97
+ for (int i = 0 ; i < 2 ; i++) {
98
+ memset (prefix_len, 0x00 , sizeof (prefix_len));
99
+ boost::asio::read (sock, boost::asio::buffer (prefix_len, 1 ), error);
100
+ int prefix_len_int = prefix_len[0 ] - ' 0' ;
101
+ memset (form_size, 0x00 , sizeof (form_size));
102
+ boost::asio::read (sock, boost::asio::buffer (form_size, prefix_len_int), error);
103
+ int form_size_int = atoi (form_size);
104
+ if (i == 0 ) {
105
+ memset (form_a, 0x00 , sizeof (form_a));
106
+ boost::asio::read (sock, boost::asio::buffer (form_a, form_size_int), error);
107
+ } else {
108
+ memset (form_b, 0x00 , sizeof (form_b));
109
+ boost::asio::read (sock, boost::asio::buffer (form_b, form_size_int), error);
110
+ }
111
+ }
112
+
90
113
if (error == boost::asio::error::eof)
91
114
return ; // Connection closed cleanly by peer.
92
115
else if (error)
@@ -145,9 +168,11 @@ void SessionFastAlgorithm(tcp::socket& sock) {
145
168
try {
146
169
integer D (disc);
147
170
integer L=root (-D, 4 );
148
- form f=form::generator (D);
149
171
PrintInfo (" Discriminant = " + to_string (D.impl ));
150
-
172
+ integer init_A (form_a);
173
+ integer init_B (form_b);
174
+ form f = form::from_abd (init_A, init_B, D);
175
+ PrintInfo (" Initial form: " + to_string (f.a .impl ) + " " + to_string (f.b .impl ));
151
176
std::vector<std::thread> threads;
152
177
const bool multi_proc_machine = (std::thread::hardware_concurrency () >= 16 ) ? true : false ;
153
178
WesolowskiCallback* weso = new FastAlgorithmCallback (segments, D, multi_proc_machine);
@@ -230,8 +255,11 @@ void SessionTwoWeso(tcp::socket& sock) {
230
255
try {
231
256
integer D (disc);
232
257
integer L=root (-D, 4 );
233
- form f = form::generator (D);
234
258
PrintInfo (" Discriminant = " + to_string (D.impl ));
259
+ integer init_A (form_a);
260
+ integer init_B (form_b);
261
+ form f = form::from_abd (init_A, init_B, D);
262
+ PrintInfo (" Initial form: " + to_string (f.a .impl ) + " " + to_string (f.b .impl ));
235
263
236
264
// Tell client that I'm ready to get the challenges.
237
265
boost::asio::write (sock, boost::asio::buffer (" OK" , 2 ));
0 commit comments