Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

projectclass.py 1.3KB

  1. ### In this file is defined a Python class to manipulate the simualtion project.
  2. ### - This class must be inherited from th class 'SimulationProject' (no need to import it)
  3. ### - You can use here the function "write(input_file, uint, nb_bits=16)"
  4. ### to write an integer of 'nb_bits' bits in the 'input_file' (no need to import it too).
  5. ### To get this simulation class in Python scripts, please use the functions in manage.py as
  6. ### - search_simulations(repository)
  7. ### - get_simulation(repository, classname=None)
  8. ### - get_simulation_via_classname(classname)
  9. class KyberNTTSimulation(SimulationProject):
  10. @classmethod
  11. def get_binary(cl):
  12. return 'project.bin'
  13. def __init__(self, *args, **kwargs):
  14. super().__init__(*args, **kwargs)
  15. def set_input(self, input):
  16. """ Write into the 'input' file of ELMO tool
  17. the parameters and the challenges for the simulation """
  18. super().set_input(input)
  19. def set_input_for_each_challenge(self, input, challenge):
  20. """ Write into the 'input' file of ELMO tool
  21. the 'challenge' for the simulation """
  22. secret = challenge
  23. # Write the secret vector
  24. for j in range(2): #k=2 for Kyber512
  25. for k in range(256): #n=256 for Kyber512
  26. write(input, secret[j,k])