StartingContributors.md - Open-CP/OCP GitHub Wiki

Quick Start for Contributors

This guide provides instructions for contributing to OCP.


Contribution to Operators

  1. Adding New Operators
  • Define a new operator class in operators/operators.py.
  • Implement the operator's functionality and modeling methods in alignment with existing operators.
  1. Extending Existing Operators
  • Add new Python and C implementations to optimize performance in generate_implementation().
  • Add new modeling techniques (e.g., "MILP", "SAT") by specifying model_type in generate_model()
  • Add new modeling versions (e.g., "diff", "truncated_diff", "linear") for various cryptanalysis techniques by specifying model_version in generate_model().

Contribution to Primitives

  1. Adding New Primitives
  • Create a new_primitive.py file in primitives/.
  • Define a new operator class in new_primitive.py and implement its structure in alignment with existing primitives.
  1. Extending Existing Primitives
  • Add new representation modes by specifying represent_mode in the corresponding primitive class to enhance flexibility.

Contribution to Cryptanalysis

  1. Adding New Cryptanalysis Techniques(e.g., Linear Cryptanalysis)
  • Implement modeling methods for the new cryptanalysis technique in operators.py.
  • Define the new attack method in attacks/attacks.py, for example, def linear_attacks(), following the structure of existing diff_attacks(). This includes:
    • Constructing MILP or SAT models for the attack.
    • Solving models using available solvers.
    • Obtaining and analyzing results.

Contribution to Automated Analysis Techniques

  1. Adding Automated Analysis Techniques
  • Extend model_type in operators.py to support additional techniques (e.g., CP).
  • Integrate the new techniques into attacks/attacks.py, such as extending model_type in diff_attack().
  1. Allowing flexible solver selection
  • Extend support support for additional solvers and enable user-defined solver configurations in solving/solving.py.
  • Currently, Gurobi is used for MILP models, and CryptoMinisat for SAT models.