This project helps users with no cryptography background select the right AES block cipher mode (ECB, CBC, OFB, CTR, GCM, SIV, XTS) by answering a short series of questions. It consists of two parts: a Python decision tree generator and a React web app.
A standalone Python script that reads the implementation usage table (ImplementationUsageTable.csv) and builds a decision tree using the ID3 algorithm. The tree splits on security-relevant attributes (e.g. integrity, error propagation, parallelism) and uses weighted information gain with a cardinality penalty to produce a multi-question path rather than a flat one-shot tree.
Features:
- Interactive mode — asks multiple-choice questions in the terminal and recommends an AES mode
- "I don't know" support — skipping a question explores all branches and returns ranked results
- Evaluation — runs 1000 random trials to measure accuracy vs. a random-choice baseline
- JSON export — outputs the tree as
quiz_tree.jsonfor use by the React frontend
Make sure Python 3 is installed. No external dependencies are required.
# Interactive mode — answers questions to recommend an AES mode
python decision_tree.py
# Print the learned decision tree structure
python decision_tree.py --print-tree
# Run evaluation (1000 trials, accuracy vs random baseline)
python decision_tree.py --evaluate
# Export the tree as JSON for the React frontend
python decision_tree.py --export-jsonA React frontend that presents the decision tree as an interactive quiz with a visual, user-friendly interface. Users click through multiple-choice questions and receive a recommended AES mode with an explanation of why it fits their needs.
cd my-app
npm install
npm run devThe decision tree generator and the React app are connected through the exported quiz_tree.json file. To update the quiz after changing the CSV table or tweaking the tree weights:
- Edit
ImplementationUsageTable.csvwith new rows/columns as needed - Run the export:
python decision_tree.py --export-json
- Copy the output into the React app:
cp quiz_tree.json my-app/src/quiz_tree.json
- The React app reads this JSON to drive its quiz flow — no manual question editing needed.
This means the web app's quiz is always generated from the same ID3 algorithm and CSV data as the command-line version.