Skip to content

Cyclic3's guide to CipheyCore (CPP side)

Cyclic3 edited this page Oct 4, 2020 · 1 revision

C++ interface structure (or lack thereof)

The C++ interface is rather scattered and non-standardised. This is because we only add things to CipheyCore that we can't get done in python with reasonable efficiency, and so it doesn't make sense to have a standardised interface. That being said, it does have a certain structure to it

Ciphers

Interface functions and their trivial implementations go in include/ciphey/ciphers.hpp. The actual implementation for each cipher has its own source file in src/ciphers. Because SWIG is not well-designed for C++, the public type definitions that are exposed to python need to go in their own header file (include/ciphey/ciphers.swig.hxx).

Each cipher has its own namespace, which should have at least:

  • a key_t type which represents the key for the cipher
  • a crack function that returns std::vector<crack_result<key_t>>
  • encrypt and decrypt functions
  • a detect function that returns a prob_t that represents the likelihood that a ciphertext was created with the cipher (this can take in extra parameters if more information is required

Other functions can exist (such as ones to determine key length)

Stats

This has no uniform interface (as it's basically just a bunch of statistical manipulations), and all the functions pretty much do as their name says. I'm not sure how to document these

AuSearch

Yeah this is crap. If you want to contribute to AuSearch, it's probably best to rewrite it from scratch.