松岡 航太郎
from sage.all import load, sqrt, RR, ZZ, pi, oo load('https://bitbucket.org/malb/lwe-estimator/raw/HEAD/estimator.py') n = 1024 # ciphertext dimension (also, key entropy) sd = 2**(-25) # noise standard deviation alpha = sqrt(2*pi)*sd # estimator defines noise rate = sqrt(2pi).stdev q = 2**32 # for compatibility only (通常のLWEはTorusじゃなくて整数係数) m = oo # the attacker can use as many samples he wishes secret_distribution = (0,1) success_probability = 0.99 # Chosen cost model(主に2種類の攻撃パターンがある) print("CLASSICAL PRIMAL") #LWEの秘密鍵を直接得る攻撃 print(primal_usvp(n, alpha, q, secret_distribution=secret_distribution, m=m, success_probability=success_probability, reduction_cost_model=BKZ.sieve)) print("CLASSICAL DUAL") #乱数と暗号文を識別する攻撃 print(dual_scale(n, alpha, q, secret_distribution=secret_distribution, m=m, success_probability=success_probability, reduction_cost_model=BKZ.sieve))
ここでは3つの方法を紹介する
X=∑iXi,Pr(X≥w)=Pr(etX≥etw)≤mint>0e−tw∏iE[etXi]X=\sum_i X_i, \mathrm{Pr}(X≥ w)=\mathrm{Pr}(e^{tX}≥ e^{tw})≤ \underset{t>0}{\min} e^{-tw}\prod_i E[e^{tX_i}] X=i∑Xi,Pr(X≥w)=Pr(etX≥etw)≤t>0mine−twi∏E[etXi]
∫f(X)p(X)dX=∫f(X)p(X)q(X)q(X)dX≈1L∑f(X(l))p(X(l))q(X(l))∫ f(X)p(X)\mathrm{d}X = ∫ f(X)\frac{p(X)}{q(X)}q(X)\mathrm{d}X ≈ \frac{1}{L}∑ f(X^{(l)})\frac{p(X^{(l)})}{q(X^{(l)})} ∫f(X)p(X)dX=∫f(X)q(X)p(X)q(X)dX≈L1∑f(X(l))q(X(l))p(X(l))
page_number: true