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
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

exploiting_design_round5.sage 2.0KB

  1. #!/usr/bin/sage -python
  2. # -*- coding: latin-1 -*-
  3. load("../framework/instance_gen.sage")
  4. verbosity = 0
  5. report_every = None
  6. """ Example
  7. Uncomment the following to get the detailed computation
  8. """
  9. # verbosity = 2
  10. # report_every = 20
  11. for params in ['R5ND_{1}KEM_0d', 'R5ND_{3}KEM_0d', 'R5ND_{5}KEM_0d']:
  12. logging("Set of parameters: " + params)
  13. if params == 'R5ND_{1}KEM_0d':
  14. n = 618
  15. m = 618
  16. q = 2 ** 11
  17. p = 2 ** 8
  18. h = 104
  19. elif params == 'R5ND_{3}KEM_0d':
  20. n = 786
  21. m = 786
  22. q = 2 ** 13
  23. p = 2 ** 9
  24. h = 384
  25. elif params == 'R5ND_{5}KEM_0d':
  26. n = 1018
  27. m = 1018
  28. q = 2 ** 14
  29. p = 2 ** 9
  30. h = 428
  31. D_s = {-1: RR(h / 2 / n), 0: RR((n - h) / n), 1: RR(h / 2 / n)}
  32. D_e = build_uniform_law(q / p)
  33. # Assessement of the attack without hints
  34. A, b, dbdd = initialize_round5_instance(DBDD_predict_diag, n,
  35. q, p, h, m, D_e, D_s,
  36. verbosity=verbosity)
  37. if report_every is not None:
  38. dbdd.integrate_q_vectors(q, indices=range(0, n + m),
  39. report_every=report_every)
  40. else:
  41. dbdd.integrate_q_vectors(q, indices=range(0, n + m))
  42. (beta, _) = dbdd.estimate_attack()
  43. logging("Attack without hints: %3.2f bikz" % beta, style="HEADER")
  44. # Assessement of the attack with hints
  45. A, b, dbdd = initialize_round5_instance(DBDD_predict, n,
  46. q, p, h, m, D_e, D_s,
  47. verbosity=verbosity)
  48. v = vec([0 if i < m else 1 for i in range(m + n)])
  49. dbdd.integrate_perfect_hint(v, 0)
  50. if report_every is not None:
  51. dbdd.integrate_q_vectors(q, indices=range(0, m), report_every=report_every)
  52. else:
  53. dbdd.integrate_q_vectors(q, indices=range(0, m))
  54. (beta, _) = dbdd.estimate_attack()
  55. logging("Attack without hints: %3.2f bikz" % beta, style="HEADER")