|
PQ-WB-KEM: White-Box ML-KEM-768 1.0
PQ-WB-KEM: Toward a White-Box Construction of ML-KEM-768 with Arithmetic Masking for M2M Communications - Mathematics (MDPI)
|
Functions | |
| _bitrev7 (k) | |
| Bit-reversal of a 7-bit index (FIPS-203 NTT twiddle order). | |
| _gauss_solve_modq (rows, rhs) | |
| Solve the over-determined linear system rows*x = rhs mod Q for x in Z_q^2. | |
| _zeta_powers () | |
| Powers of zeta mod q for the NTT. | |
| base_mul_direct (s0, s1, c0, c1, gamma) | |
| Base multiply for one degree-2 factor from full-range operands. | |
| base_mul_encoded (s0, s1, c0, c1, gamma, E, i) | |
| Encoded output E_{i,0}(p0), E_{i,1}(p1) of the plain product. | |
| build_encodings (rng) | |
| Secret nonlinear I/O encodings: two random bijections on Z_q per component plus their inverses. | |
| main () | |
| Build encodings over the real full-range secret, verify decode correctness, measure encoding footprint, run the algebraic attack. | |
| ntt_forward (poly) | |
| Forward NTT: coefficient domain to NTT domain (full-range image). | |
| solve_component (observations, gamma, encoding_inverse=None) | |
| Recover full-range (s0,s1) for one component from chosen-ciphertext observations by linear solve over Z_q. | |
Variables | |
| list | GAMMAS = [pow(ZETA, 2 * _bitrev7(i) + 1, Q) for i in range(NUM_COMPONENTS)] |
| int | K = 3 |
| int | N = 256 |
| int | NUM_COMPONENTS = N // 2 |
| int | Q = 3329 |
| int | SEED = 42 |
| int | ZETA = 17 |
| ZETA_POWERS = _zeta_powers() | |
|
protected |
Bit-reversal of a 7-bit index (FIPS-203 NTT twiddle order).
| k | Index in [0, 128). |
Definition at line 64 of file whitebox_encoded.py.
Referenced by ntt_forward().
Here is the caller graph for this function:
|
protected |
Solve the over-determined linear system rows*x = rhs mod Q for x in Z_q^2.
Definition at line 159 of file whitebox_encoded.py.
Referenced by solve_component().
Here is the caller graph for this function:
|
protected |
Powers of zeta mod q for the NTT.
Definition at line 49 of file whitebox_encoded.py.
| whitebox_encoded.base_mul_direct | ( | s0, | |
| s1, | |||
| c0, | |||
| c1, | |||
| gamma | |||
| ) |
Base multiply for one degree-2 factor from full-range operands.
| s0 | s1 Full-range NTT-domain secret coordinates. |
| c0 | c1 Ciphertext coordinates; |
| gamma | Component twiddle. |
Definition at line 115 of file whitebox_encoded.py.
| whitebox_encoded.base_mul_encoded | ( | s0, | |
| s1, | |||
| c0, | |||
| c1, | |||
| gamma, | |||
| E, | |||
| i | |||
| ) |
Encoded output E_{i,0}(p0), E_{i,1}(p1) of the plain product.
Definition at line 127 of file whitebox_encoded.py.
Referenced by main().
Here is the caller graph for this function:| whitebox_encoded.build_encodings | ( | rng | ) |
Secret nonlinear I/O encodings: two random bijections on Z_q per component plus their inverses.
| rng | Seeded NumPy generator. |
Definition at line 96 of file whitebox_encoded.py.
Referenced by encoding_layer_entropy.main().
Here is the caller graph for this function:| whitebox_encoded.main | ( | void | ) |
Build encodings over the real full-range secret, verify decode correctness, measure encoding footprint, run the algebraic attack.
Definition at line 195 of file whitebox_encoded.py.
References base_mul_encoded(), main(), and solve_component().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| whitebox_encoded.ntt_forward | ( | poly | ) |
Forward NTT: coefficient domain to NTT domain (full-range image).
| poly | Length-256 coefficient vector. |
Definition at line 76 of file whitebox_encoded.py.
References _bitrev7().
Here is the call graph for this function:| whitebox_encoded.solve_component | ( | observations, | |
| gamma, | |||
encoding_inverse = None |
|||
| ) |
Recover full-range (s0,s1) for one component from chosen-ciphertext observations by linear solve over Z_q.
| observations | List of (c0,c1,o0,o1) tuples. |
| gamma | Component twiddle constant. |
| encoding_inverse | Optional (inv0,inv1) tables; decodes outputs first. |
Relation is linear in (s0,s1): o0 = s0*c0 + gamma*s1*c1, o1 = s0*c1 + s1*c0; queries are stacked into the system.
Definition at line 136 of file whitebox_encoded.py.
References _gauss_solve_modq().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| list whitebox_encoded.GAMMAS = [pow(ZETA, 2 * _bitrev7(i) + 1, Q) for i in range(NUM_COMPONENTS)] |
Definition at line 73 of file whitebox_encoded.py.
| int whitebox_encoded.K = 3 |
Definition at line 43 of file whitebox_encoded.py.
| int whitebox_encoded.N = 256 |
Definition at line 42 of file whitebox_encoded.py.
| int whitebox_encoded.NUM_COMPONENTS = N // 2 |
Definition at line 44 of file whitebox_encoded.py.
| int whitebox_encoded.Q = 3329 |
Definition at line 41 of file whitebox_encoded.py.
| int whitebox_encoded.SEED = 42 |
Definition at line 46 of file whitebox_encoded.py.
| int whitebox_encoded.ZETA = 17 |
Definition at line 45 of file whitebox_encoded.py.
| whitebox_encoded.ZETA_POWERS = _zeta_powers() |
Definition at line 61 of file whitebox_encoded.py.