Fork of the official github repository of the framework Leaky-LWE-Estimator, a Sage Toolkit to attack and estimate the hardness of LWE with Side Information. https://github.com/lducas/leaky-LWE-Estimator
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

exploiting_decryption_failures.sage 1.6KB

vor 4 Jahren
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. load("../framework/instance_gen.sage")
  2. verbosity = 0
  3. report_every = None
  4. """ Example
  5. Uncomment the following to get the detailed computation
  6. """
  7. # verbosity = 2
  8. # report_every = 20
  9. # FRODOKEM parameters
  10. n = 976
  11. m = 976
  12. q = 2**16
  13. t = q / 16
  14. D_s = {- 10: 1.52587890625e-05, - 9: 9.1552734375e-05, - 8: 0.0004425048828125,
  15. - 7: 0.001800537109375, - 6: 0.00604248046875, - 5: 0.0167999267578125,
  16. - 4: 0.0388336181640625, - 3: 0.074493408203125, - 2: 0.118621826171875,
  17. - 1: 0.1568145751953125, 0: 0.172088623046875, 1: 0.1568145751953125,
  18. 2: 0.118621826171875, 3: 0.074493408203125, 4: 0.0388336181640625,
  19. 5: 0.0167999267578125, 6: 0.00604248046875, 7: 0.001800537109375,
  20. 8: 0.0004425048828125, 9: 9.1552734375e-05, 10: 1.52587890625e-05}
  21. D_e = D_s
  22. _, var = average_variance(D_s)
  23. d = n + m
  24. ell = RR(sqrt(d * var))
  25. # nu2 = RR(var * ell**4 / (t**2))
  26. # for k in [0, 1, 2, 4, 8, 16, 32, 64, 128, 256]:
  27. # xx = 1 / (1 / var + k / nu2)
  28. # print(k, RR(xx / var))
  29. covh = RR(var * ell**4 / (t**2)) * identity_matrix(d)
  30. _, _, inst = initialize_from_LWE_instance(DBDD_predict_diag, n, q,
  31. m, D_e, D_s, verbosity=verbosity)
  32. print("# failures, relative variance, bit-security (1 bit = 0.265 bikz) ")
  33. for i in range(0, 256):
  34. if report_every is not None:
  35. inst.integrate_q_vectors(q, indices=range(d),
  36. report_every=report_every)
  37. else:
  38. inst.integrate_q_vectors(q, indices=range(d))
  39. print(i, ",\t \t \t", inst.S[0] / var, ",\t \t \t", inst.beta * .265)
  40. inst.integrate_approx_hint_fulldim(None, covh)