Skip to content

Enigma #54

Merged
cyberzac merged 13 commits intomasterfrom
feature/enigma
Dec 11, 2025
Merged

Enigma #54
cyberzac merged 13 commits intomasterfrom
feature/enigma

Conversation

@cyberzac
Copy link
Collaborator

@cyberzac cyberzac commented Dec 3, 2025

Provides enigma encryption for Cryptid.
Also a cli tool for enigma encryption/decryption

Add Enigma cipher module:

- Introduced `cipher-enigma` module with support for Enigma machine simulation.
- Implemented key components: `Rotor`, `RotorState`, `Rotors`, `Reflector`, and `Enigma` core logic.
- Added extensive unit tests to validate rotor behavior, reflector mappings, carry logic, and encryption workflow.
- Updated `build.sbt` to include `cipher-enigma` module and dependencies.
- Replaced `RotorState` with streamlined `Rotor` model, integrating offset-based transformations.
- Introduced `Wheel` abstraction to encapsulate rotor wiring and notch logic, improving modularity.
- Added dedicated tests for `Rotor.apply` and `Rotors.apply` settings parsing and validation.
- Enhanced encryption tests to validate carry logic, rotor rotations, and backward compatibility.
- Minor improvements in `Glyph` extensions and resource loading utilities.
- Enhanced `Settings` to handle rotor position adjustments and improve parsing logic for varied input formats.
- Updated `Enigma` encryption and decryption flow to include random positions and keys in messages, to follow German army practice.
- Optimized `Glyph` with random glyph generation and added byte conversion extensions.
- Refined `Rotors` to expose size, position updates, and enhance stepping mechanism with improved logging.
- Adjusted test cases to validate new settings, encryption flow, and message preambles.
- Enhanced `Settings` to handle rotor position adjustments and improve parsing logic for varied input formats.
- Updated `Enigma` encryption and decryption flow to include random positions and keys in messages, to follow German army practice.
- Optimized `Glyph` with random glyph generation and added byte conversion extensions.
- Refined `Rotors` to expose size, position updates, and enhance stepping mechanism with improved logging.
- Adjusted test cases to validate new settings, encryption flow, and message preambles.
- Added `PlugBoard` implementation to support plugboard swapping in the Enigma machine.
- Updated `Settings` to handle plugboard parsing and validation.
- Refactored `Enigma` encryption/decryption logic to integrate plugboard swaps before and after rotor operations.
- Expanded unit tests to validate plugboard behavior, settings parsing, and encryption alignment with plugboard configuration.
- Consolidated regex patterns for settings parsing into a single format.
- Enhanced error handling in decryption with validation for inconsistent keys.
- Adjusted encryption/decryption constructors to replace `base` parameter with `settings`.
- Improved Scaladoc formatting for methods, ensuring clarity and adherence to style guidelines.
- Added CLI entry point for the Enigma module using `mainargs` for better command-line handling.
- Integrated `sbt-assembly` to enable building executable fat jars with proper merging strategies.
- Updated `Settings` to support preamble handling and extracted it into a standalone class.
- Enhanced encryption/decryption logic and documentation for improved usability and clarity.
- Moved CLI logic to a dedicated `CLI` object for cleaner architecture and separation of concerns.
- Updated `build.sbt` to replace the entry point with the new `CLI` object and implement a self-contained bash script launcher embedding the fat jar.
- Enhanced error handling and usage documentation for the `Settings` class, introducing a parsed `Try[Settings]` for better validation flow.
- Refined `Settings` parsing with improved exception messaging and preamble formatting.‍‍
- Renamed CLI parameters for better clarity (e.g., `decrypt` to `decryptMode`).
- Improved processing flow by consolidating operations into `process` and `reportError` methods.
- Enhanced preamble encoding/decoding with stricter input validation and error messaging.
- Removed redundant imports and streamlined `Settings` handling logic.
- Merged input handling methods (`readAllStdin`, `readFile`) to avoid redundancy.
- Introduced `group5` extension for consistent five-letter grouping.
- Simplified encoding/decoding workflows by consolidating redundant logic.
- Improved readability of `encode` and `decode` methods using streamlined transformations.
- Added comprehensive Scaladoc for the `CLI` object, describing arguments, methods, and extensions.
- Improved documentation of encryption/decryption workflows, input handling, and usage examples.
- Added comprehensive Scaladoc for `Rotor`, `Wheel`, `Glyph`, `Rotors`, and `PlugBoard` classes.
- Improved clarity on behaviors, constructors, and usage examples in all core Enigma components.
- Enhanced validation and operation explanations, aligning documentation with recent refactoring improvements.
@cyberzac cyberzac requested a review from odd December 3, 2025 00:30
- Replaced `IArray` with `Seq` in `Rotors` and `PlugBoard` for improved usability and consistency.
- Enhanced `Rotor.toString` for better readability and alignment with user-friendly formatting.
- Revised `Settings.parse` regex to enforce consistent spacing, improving input validation.
- Simplified `PlugBoardSpec` tests by introducing property-based checks for plugboard behavior.
- Added `SettingsSpec` to validate different configurations and edge cases.
- Refactored test cases across components to improve clarity, coverage, and maintainability.
@cyberzac cyberzac merged commit 692d8eb into master Dec 11, 2025
6 checks passed
@cyberzac cyberzac deleted the feature/enigma branch December 11, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant