|
7 | 7 | "tags": [] |
8 | 8 | }, |
9 | 9 | "source": [ |
10 | | - "# Hidden-Shift problem for bent functions using the classiq platform" |
| 10 | + "# Hidden-Shift Problem for Bent Functions" |
11 | 11 | ] |
12 | 12 | }, |
13 | 13 | { |
14 | 14 | "cell_type": "markdown", |
15 | 15 | "id": "450fbc3a-2837-44e7-90bc-e695a87ba220", |
16 | 16 | "metadata": {}, |
17 | 17 | "source": [ |
18 | | - "Here we implement the hidden shift algorithm for the familty of boolean bent functions." |
| 18 | + "Here we implement the hidden shift algorithm for the family of Boolean bent functions using the Classiq platform." |
19 | 19 | ] |
20 | 20 | }, |
21 | 21 | { |
22 | 22 | "cell_type": "markdown", |
23 | 23 | "id": "a13a1783-065a-46aa-9967-ba2d5affd33e", |
24 | 24 | "metadata": {}, |
25 | 25 | "source": [ |
26 | | - "First, make sure we have all necessary packages:" |
| 26 | + "Make sure we have all necessary packages:" |
27 | 27 | ] |
28 | 28 | }, |
29 | 29 | { |
|
51 | 51 | "tags": [] |
52 | 52 | }, |
53 | 53 | "source": [ |
54 | | - "On the first part, we assume we know how to implement the dual of $f$, and get $s$ according to the algorithm in [[1](#first)]:" |
| 54 | + "We assume we know how to implement the dual of $f$ and get $s$ according to the algorithm in [[1](#first)]:" |
55 | 55 | ] |
56 | 56 | }, |
57 | 57 | { |
|
63 | 63 | { |
64 | 64 | "name": "stdout", |
65 | 65 | "output_type": "stream", |
66 | | - "text": [ |
67 | | - "" |
68 | | - ] |
| 66 | + "text": [] |
69 | 67 | } |
70 | 68 | ], |
71 | 69 | "source": [ |
|
143 | 141 | "id": "64d54218-7d9c-420a-92ff-1f719d2aa638", |
144 | 142 | "metadata": {}, |
145 | 143 | "source": [ |
146 | | - "# More complex functions" |
| 144 | + "## More Complex Functions" |
147 | 145 | ] |
148 | 146 | }, |
149 | 147 | { |
|
239 | 237 | "id": "c27a578d-5380-460d-9833-15557d4e292a", |
240 | 238 | "metadata": {}, |
241 | 239 | "source": [ |
242 | | - "## Now create the ciruit:" |
| 240 | + "## Creating the Circuit" |
243 | 241 | ] |
244 | 242 | }, |
245 | 243 | { |
|
253 | 251 | "output_type": "stream", |
254 | 252 | "text": [ |
255 | 253 | "f_dual: (((((((((x[5]) & (y[0])) ^ ((x[2]) & (y[1]))) ^ ((x[7]) & (y[2]))) ^ ((x[0]) & (y[3]))) ^ ((x[6]) & (y[4]))) ^ ((x[3]) & (y[5]))) ^ ((x[1]) & (y[6]))) ^ ((x[4]) & (y[7]))) ^ ((((((((x[5]) & (x[2])) & (x[7])) & (x[0])) & (x[6])) & (x[3])) & (x[1])) & (x[4]))\n", |
256 | | - "g: (((((((((x[0]) & (y[3])) ^ (((x[1]) ^ 1) & (y[6]))) ^ ((x[2]) & ((y[1]) ^ 1))) ^ (((x[3]) ^ 1) & (y[5]))) ^ ((x[4]) & (y[7]))) ^ ((x[5]) & (y[0]))) ^ ((x[6]) & (y[4]))) ^ ((x[7]) & (y[2]))) ^ ((((((((y[0]) & ((y[1]) ^ 1)) & (y[2])) & (y[3])) & (y[4])) & (y[5])) & (y[6])) & (y[7]))\n", |
257 | | - "" |
| 254 | + "g: (((((((((x[0]) & (y[3])) ^ (((x[1]) ^ 1) & (y[6]))) ^ ((x[2]) & ((y[1]) ^ 1))) ^ (((x[3]) ^ 1) & (y[5]))) ^ ((x[4]) & (y[7]))) ^ ((x[5]) & (y[0]))) ^ ((x[6]) & (y[4]))) ^ ((x[7]) & (y[2]))) ^ ((((((((y[0]) & ((y[1]) ^ 1)) & (y[2])) & (y[3])) & (y[4])) & (y[5])) & (y[6])) & (y[7]))\n" |
258 | 255 | ] |
259 | 256 | } |
260 | 257 | ], |
|
359 | 356 | "tags": [] |
360 | 357 | }, |
361 | 358 | "source": [ |
362 | | - "# Hidden Shift without the dual function" |
| 359 | + "## Hidden Shift Without the Dual Function" |
363 | 360 | ] |
364 | 361 | }, |
365 | 362 | { |
|
372 | 369 | "id": "0bf70e08-3ea7-43b8-afc2-0271f124323f", |
373 | 370 | "metadata": {}, |
374 | 371 | "source": [ |
375 | | - "We now use the second algorithm described in [[2](#second)]. This algorithm only requires to implement $f$ and not its dual, however requires $O(n)$ samples from the circuit.\n", |
| 372 | + "We now use the second algorithm described in [[2](#second)]. This algorithm only requires implementing $f$ and not its dual; however, it requires $O(n)$ samples from the circuit.\n", |
376 | 373 | "" |
377 | 374 | ] |
378 | 375 | }, |
|
389 | 386 | "output_type": "stream", |
390 | 387 | "text": [ |
391 | 388 | "f: (((((((((x[0]) & (y[3])) ^ ((x[1]) & (y[6]))) ^ ((x[2]) & (y[1]))) ^ ((x[3]) & (y[5]))) ^ ((x[4]) & (y[7]))) ^ ((x[5]) & (y[0]))) ^ ((x[6]) & (y[4]))) ^ ((x[7]) & (y[2]))) ^ ((((((((y[0]) & (y[1])) & (y[2])) & (y[3])) & (y[4])) & (y[5])) & (y[6])) & (y[7]))\n", |
392 | | - "g: (((((((((x[0]) & (y[3])) ^ (((x[1]) ^ 1) & (y[6]))) ^ ((x[2]) & ((y[1]) ^ 1))) ^ (((x[3]) ^ 1) & (y[5]))) ^ ((x[4]) & (y[7]))) ^ ((x[5]) & (y[0]))) ^ ((x[6]) & (y[4]))) ^ ((x[7]) & (y[2]))) ^ ((((((((y[0]) & ((y[1]) ^ 1)) & (y[2])) & (y[3])) & (y[4])) & (y[5])) & (y[6])) & (y[7]))\n", |
393 | | - "" |
| 389 | + "g: (((((((((x[0]) & (y[3])) ^ (((x[1]) ^ 1) & (y[6]))) ^ ((x[2]) & ((y[1]) ^ 1))) ^ (((x[3]) ^ 1) & (y[5]))) ^ ((x[4]) & (y[7]))) ^ ((x[5]) & (y[0]))) ^ ((x[6]) & (y[4]))) ^ ((x[7]) & (y[2]))) ^ ((((((((y[0]) & ((y[1]) ^ 1)) & (y[2])) & (y[3])) & (y[4])) & (y[5])) & (y[6])) & (y[7]))\n" |
394 | 390 | ] |
395 | 391 | } |
396 | 392 | ], |
|
451 | 447 | "metadata": {}, |
452 | 448 | "source": [ |
453 | 449 | "Out of the sampled results, we look for $n$ independent samples, from which we can extract s.\n", |
454 | | - "1000 samples should be enough with a very high probability." |
| 450 | + "One thousand samples should be enough with a very high probability." |
455 | 451 | ] |
456 | 452 | }, |
457 | 453 | { |
|
464 | 460 | "outputs": [], |
465 | 461 | "source": [ |
466 | 462 | "# The galois library is a package that extends NumPy arrays to operate over finite fields.\n", |
467 | | - "# we wlll use it as our equations are binary equations\n", |
| 463 | + "# we will use it as our equations are binary equations\n", |
468 | 464 | "import galois\n", |
469 | 465 | "\n", |
470 | | - "# here we work over boolean arithmetics - F(2)\n", |
| 466 | + "# here we work over Boolean arithmetics - F(2)\n", |
471 | 467 | "GF = galois.GF(2)\n", |
472 | 468 | "\n", |
473 | 469 | "\n", |
|
507 | 503 | "tags": [] |
508 | 504 | }, |
509 | 505 | "source": [ |
510 | | - "We now left with solving the equation and extracting $s$:" |
| 506 | + "We now solve the equation and extract $s$:" |
511 | 507 | ] |
512 | 508 | }, |
513 | 509 | { |
|
543 | 539 | "id": "2e47bb31-04e8-4698-b42e-13ca9722018e", |
544 | 540 | "metadata": {}, |
545 | 541 | "source": [ |
546 | | - "And we got successfully the same shift." |
| 542 | + "And we successfully received the same shift." |
547 | 543 | ] |
548 | 544 | }, |
549 | 545 | { |
|
0 commit comments