How fordcois/cryptography works
Main Components
• Data/Input:
• “cipher_texts” directory contains plaintext examples from literary works (e.g., texts from “A Tale of Two Cities”, “Moby Dick”, etc.) that serve as inputs for experimenting with ciphers.
• “whitelisted_words.txt” (present in both root and within lib) provides word lists for validation.
• Core Functionality (Prime Logic):
• Under “lib/encrypt_functions”: modules for cipher algorithms including Caesar, keyword cipher, and punctuation removal. These represent the encryption/decryption logic.
• “lib/validation_tools”: functions for checking accuracy and validating whether a decrypted solution is correct.
• Supporting Utilities:
• “utilities”: contains auxiliary classes and functions (e.g., a CipherSymbol object to track symbol likelihoods and a module to import text files).
• Documentation and Analysis:
• “documentation”: holds markdown files that document experiments and detailed frequency analyses, explaining the rationale behind frequency, bigraph, and pattern analysis.
• Testing:
• “tests”: contains unit tests for the encryption functions and validation tools (making sure each cipher method functions as expected).
Relationships and Interactions
• Data Flow:
• Input texts (from “cipher_texts” and via “utilities/txt_import.py”) are fed into the encryption functions.
• The encryption functions, which implement the cipher algorithms (from “lib/encrypt_functions”), process the text (removing punctuation, substitution through Caesar or keyword ciphers).
• The processed output is then passed to the validation tools (located in “lib/validation_tools”) to check decryption accuracy against the whitelisted words.
• Supporting Feedback Loop:
• The results from validation can be used to refine parameters, which is part of the learning and experiment cycle (documented in “documentation”).
• Testing and Continuous Integration:
• The “tests” module ensures that changes in encryption functions or validation logic do not break existing functionality.
Architectural Patterns & Principles
• Modular Design: Distinct modules for encryption, validation, and utilities promote separation of concerns.
Final Reminder to the Principal Software Engineer
• Labels are clear and unambiguous.
• Remember that the modular separation (for instance, separating encryption functions from validation tools) is crucial to both understand and potentially scale the experimental framework.