|
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). | |
| Tuple[float, int] | dca_attack (np.ndarray traces, np.ndarray hypotheses) |
| Correlation-based DCA key-recovery attack. | |
| np.ndarray | generate_secret_key () |
| Generate secret key via centered binomial distribution CBD(eta=2). | |
| np.ndarray | hamming_weight (np.ndarray x) |
| Hamming weight of each element treated as a 12-bit value (q=3329). | |
| main () | |
| Entry point; runs the suite and writes results/dca_simulation.json. | |
| np.ndarray | ntt_forward (np.ndarray poly) |
| Forward NTT: coefficient domain to NTT domain (full-range image). | |
| np.ndarray | ntt_secret () |
| Full-range NTT-domain secret shat = NTT(s), the operand the base multiply actually processes (coefficient-domain smallness does not carry into the NTT domain). | |
| float | pearson_correlation (np.ndarray x, np.ndarray y) |
| Pearson correlation coefficient; 0.0 if either input has zero variance. | |
| Dict | run_dca_simulation (int num_traces=10000, bool masked=True, int num_shares=3) |
| Run one DCA simulation and report correct-vs-random key correlation. | |
| Dict | run_full_simulation (List[int] num_traces_list=[1000, 10000, 100000, 500000]) |
| Run the full DCA suite comparing masked vs unmasked implementations. | |
| np.ndarray | simulate_masked_trace (np.ndarray secret, np.ndarray ciphertext, int num_shares=3) |
| Simulated power trace for n-share arithmetic-masked implementation. | |
| np.ndarray | simulate_unmasked_trace (np.ndarray secret, np.ndarray ciphertext) |
| Simulated power trace for unmasked implementation. | |
Variables | |
| _ZP = np.zeros(256, dtype=np.int64) | |
| int | ETA = 2 |
| int | N = 256 |
| int | Q = 3329 |
| int | ZETA = 17 |
|
protected |
Bit-reversal of a 7-bit index (FIPS-203 NTT twiddle order).
| k | Index in [0, 128). |
Definition at line 53 of file dca_simulation.py.
Referenced by ntt_forward().
Here is the caller graph for this function:| Tuple[float, int] dca_simulation.dca_attack | ( | np.ndarray | traces, |
| np.ndarray | hypotheses | ||
| ) |
Correlation-based DCA key-recovery attack.
| traces | Shape (num_traces, num_points) collected traces. |
| hypotheses | Shape (num_keys, num_traces) hypothesis values per key guess. |
Definition at line 169 of file dca_simulation.py.
References pearson_correlation().
Here is the call graph for this function:| np.ndarray dca_simulation.generate_secret_key | ( | ) |
Generate secret key via centered binomial distribution CBD(eta=2).
Definition at line 82 of file dca_simulation.py.
Referenced by ntt_secret().
Here is the caller graph for this function:| np.ndarray dca_simulation.hamming_weight | ( | np.ndarray | x | ) |
Hamming weight of each element treated as a 12-bit value (q=3329).
| x | Input array. |
Definition at line 102 of file dca_simulation.py.
Referenced by run_dca_simulation(), simulate_masked_trace(), and simulate_unmasked_trace().
Here is the caller graph for this function:| dca_simulation.main | ( | void | ) |
Entry point; runs the suite and writes results/dca_simulation.json.
Definition at line 371 of file dca_simulation.py.
References main(), and run_full_simulation().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| np.ndarray dca_simulation.ntt_forward | ( | np.ndarray | poly | ) |
Forward NTT: coefficient domain to NTT domain (full-range image).
| poly | Length-256 coefficient vector. |
Definition at line 62 of file dca_simulation.py.
References _bitrev7().
Here is the call graph for this function:| np.ndarray dca_simulation.ntt_secret | ( | ) |
Full-range NTT-domain secret shat = NTT(s), the operand the base multiply actually processes (coefficient-domain smallness does not carry into the NTT domain).
Definition at line 92 of file dca_simulation.py.
References generate_secret_key().
Referenced by run_dca_simulation().
Here is the call graph for this function:
Here is the caller graph for this function:| float dca_simulation.pearson_correlation | ( | np.ndarray | x, |
| np.ndarray | y | ||
| ) |
Pearson correlation coefficient; 0.0 if either input has zero variance.
| x | First series. |
| y | Second series. |
Definition at line 157 of file dca_simulation.py.
Referenced by dca_attack(), and run_dca_simulation().
Here is the caller graph for this function:| Dict dca_simulation.run_dca_simulation | ( | int | num_traces = 10000, |
| bool | masked = True, |
||
| int | num_shares = 3 |
||
| ) |
Run one DCA simulation and report correct-vs-random key correlation.
| num_traces | Number of traces to collect. |
| masked | Use masked implementation when True. |
| num_shares | Number of shares for masking. |
Definition at line 193 of file dca_simulation.py.
References hamming_weight(), ntt_secret(), pearson_correlation(), simulate_masked_trace(), and simulate_unmasked_trace().
Referenced by run_full_simulation().
Here is the call graph for this function:
Here is the caller graph for this function:| Dict dca_simulation.run_full_simulation | ( | List[int] | num_traces_list = [1000, 10000, 100000, 500000] | ) |
Run the full DCA suite comparing masked vs unmasked implementations.
| num_traces_list | Trace counts for the masked-implementation sweep. |
Definition at line 293 of file dca_simulation.py.
References run_dca_simulation().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| np.ndarray dca_simulation.simulate_masked_trace | ( | np.ndarray | secret, |
| np.ndarray | ciphertext, | ||
| int | num_shares = 3 |
||
| ) |
Simulated power trace for n-share arithmetic-masked implementation.
| secret | Secret key coefficients. |
| ciphertext | Ciphertext coefficients. |
| num_shares | Number of arithmetic shares. |
Definition at line 128 of file dca_simulation.py.
References hamming_weight().
Referenced by run_dca_simulation().
Here is the call graph for this function:
Here is the caller graph for this function:| np.ndarray dca_simulation.simulate_unmasked_trace | ( | np.ndarray | secret, |
| np.ndarray | ciphertext | ||
| ) |
Simulated power trace for unmasked implementation.
| secret | Secret key coefficients. |
| ciphertext | Ciphertext coefficients. |
Definition at line 115 of file dca_simulation.py.
References hamming_weight().
Referenced by run_dca_simulation().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
Definition at line 47 of file dca_simulation.py.
| int dca_simulation.ETA = 2 |
Definition at line 42 of file dca_simulation.py.
| int dca_simulation.N = 256 |
Definition at line 41 of file dca_simulation.py.
| int dca_simulation.Q = 3329 |
Definition at line 40 of file dca_simulation.py.
| int dca_simulation.ZETA = 17 |
Definition at line 43 of file dca_simulation.py.