lducas / leaky-LWE-Estimator

A sage Toolkit for mounting/estimating attacks on LWE with Side Information
37 stars 16 forks source link

Does Svol in function `volumes` in `DBDD_predict_diag.sage` means the log(norm) of the target vector? #12

Open Summwer opened 1 year ago

Summwer commented 1 year ago

Hello, developer,

​ Does Svol in function volumes in DBDD_predict_diag.sage means the log(norm) of the target vector? If is, then I think maybe there's a mistake in computing the log(norm) of the target vector. This mistake might occur while secret vector and noise vector follows different distribution.

​ I see in the file instance_gen.sage, you initialize the array S in function initialize_from_LWE_instance by S = diagonal_matrix(m * [s_e] + n * [s_s] + [0]).

​ And in the function integrate_q_vectors, you decrease the dimension of lwe instance by deleting the q-vector from large index to small by the function integrate_short_vector_hint. If the q-vector could be deleted, then let S[i] = 0. However, I test the Kyber scheme($\eta_1 = 3$, $\eta_2$ = 2, m=512, n = 512, intitial_d = 1025), where s_e=1. and s_s=1.5 in function initialize_from_LWE_instance. In function integrate_q_vectors and I print the index i in function integrate_q_vectors:

image

it outputs i-index accounted from large($d-2$) to small:

image

In function integrate_short_vector_hint, if we print i and S[i]:

image

We can see that it makes S[i] = 0, where S[i]=s_s:

image

Since in LWE instance, we can decrease the samples in LWE to find a small matrix for reduction. Let the original target norm be $a$, I think the target norm should become $a - s_e$ by deleting a q-vector and one sample in matrix A, but you delete an s_s in S, where S is used to compute the Svol in function volumes in DBDD_predict_diag.sage:

image

Is Svol the log(norm) of the target vector? If is, then I think maybe there's a mistake in computing the log(norm) of the target vector. This mistake might occur while secret vector and noise vector follows different distribution.

lducas commented 1 month ago

No, SVol is the (logarithm of) determinant of the ellipsoid that defines the error distribution.