{"id":15678131,"url":"https://github.com/mp911de/enigma4j","last_synced_at":"2026-02-28T17:02:55.492Z","repository":{"id":141688419,"uuid":"358525296","full_name":"mp911de/enigma4j","owner":"mp911de","description":"Enigma ⚙️⚙️⚙️  Emulator for Java :coffee:","archived":false,"fork":false,"pushed_at":"2021-07-21T06:27:19.000Z","size":80,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T02:25:31.714Z","etag":null,"topics":["cipher","crypto","enigma-machine"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mp911de.png","metadata":{"files":{"readme":"readme.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-16T08:13:18.000Z","updated_at":"2023-10-11T18:44:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"49c79b17-c04f-487f-a6ee-d7797866dbcb","html_url":"https://github.com/mp911de/enigma4j","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mp911de/enigma4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Fenigma4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Fenigma4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Fenigma4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Fenigma4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mp911de","download_url":"https://codeload.github.com/mp911de/enigma4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp911de%2Fenigma4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29943665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:49:17.081Z","status":"ssl_error","status_checked_at":"2026-02-28T13:48:50.396Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cipher","crypto","enigma-machine"],"created_at":"2024-10-03T16:17:19.491Z","updated_at":"2026-02-28T17:02:55.471Z","avatar_url":"https://github.com/mp911de.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Enigma4J (Enigma Emulator for Java)\n\nThis project contains an emulation of the https://en.wikipedia.org/wiki/Enigma_machine[Enigma machine] using Java 16. Enigma is a cipher device invented in 1918. It became later on popular during World War II.\n\nEnigma is an electric device comprised of a keyboard, 3-5 https://en.wikipedia.org/wiki/Enigma_rotor_details[rotors], an optional https://en.wikipedia.org/wiki/Enigma_machine#Plugboard[plugboard] and 26 output lights.\nBasically, it's an electric circuit with mechanically rotating wheels that change the circuit wiring between input- and output characters.\n\nThe principle of Enigma is having rotors with a specific wiring between an input- and output port which compares well to an encryption key.\nInput letters are re-routed (scrambled) to an output letter.\nThis happens multiple times in forward- and reverse direction.\nAdditionally, when entering a key and before sending the signal through a rotor, the rotor rotates by one position which leads the machine to encrypt successive same characters to different outputs.\nRotors can have notches at certain positions that advance the subsequent rotor (similar to a mileage counter that turns over from `9` to `0`).\n\nFinally, there were commercial and military machines.\nMilitary machines could have a plug board to re-route individual characters.\nIt is a freely configurable routing matrix between each of the 26 letters allowing to attach 10 patches to alter character routing of 20 of the 26 letters.\nFor example the patching `AT` would translate `A` to `T` and vice versa.\nPlugboard routing works for either of the entered letters and works in both directions (input, and signal output) which adds further combinations to the overall keyspace leaving the machine with https://crypto.stackexchange.com/questions/33628/how-many-possible-enigma-machine-settings[`158,962,555,217,826,360,000`] combinations.\n\nA specific behavior (later a weakness) of the machine is that a letter could never encrypt to itself which finally lead to its https://en.wikipedia.org/wiki/Cryptanalysis_of_the_Enigma[decryption].\n\nThe Enigma machine itself has no dedicated encryption/decryption mode.\nTo encrypt a message, spin up a `Enigma` instance and enter your message.\nThe receiver spins up the exact same instance with the same initial settings (rotor positions, plug board) and enters the encrypted message to turn it into plain text.\n\n== Java Emulator\n\nThis emulator consists of an inventory of machines, see link:src/main/resources/inventory.json[`inventory.json`] that can be loaded and instantiated for crypto use.\n\n[source,java]\n----\nvar inventory = Inventory.load();\nvar modelI = inventory.getModel(new Inventory.ModelIdentifier(\"Enigma I\"));\nvar enigma = modelI.createInstance();\nvar rotorPositions = enigma.getRotorPositions();\n\nassertThat(enigma.process(\"WURSTSALAT\")).isEqualTo(\"FXYKEONOEX\");\n\nenigma.setRotorPositions(rotorPositions);\nassertThat(enigma.process(\"FXYKEONOEX\")).isEqualTo(\"WURSTSALAT\");\n----\n\nIndividual machines can be configured before their actual usage:\n\n[source,java]\n----\nvar inventory = Inventory.load();\nvar modelI = inventory.getModel(new Inventory.ModelIdentifier(\"Enigma I\"));\n\nvar enigma = modelI.createInstance(c -\u003e {\n    c.rotors((rotorConfiguration, rotorSelector) -\u003e rotorConfiguration\n            .withRotors(rotorSelector.getRotors(\"II\", \"I\", \"III\")).withPositions(1, 2, 3));\n});\n\nassertThat(enigma.process(\"WURSTSALAT\")).isEqualTo(\"BPLKHVVVKT\");\n----\n\nFinally, there's a `EnigmaWriter` for stream-processing of textual data:\n\n[source,java]\n----\nStringWriter out = new StringWriter();\n\nPrintWriter pw = new PrintWriter(new EnigmaWriter(out, instance));\npw.print(\"hallowelt\");\n\nassertThat(out.toString()).isEqualToIgnoringCase(\"alsyipmon\");\n----\n\n== Building from Source\n\nThe code can be easily build with the maven wrapper.\nYou also need JDK 16.\n\n[source,bash]\n----\n $ ./mvnw clean install\n----\n\nIf you want to build with the regular mvn command, you will need Maven v3.5.0 or above.\n\n== Other Emulations\n\n* https://summersidemakerspace.ca/projects/enigma-machine/[Summerside Makerspace]\n* http://people.physik.hu-berlin.de/~palloks/js/enigma/enigma-u_v25.html[Universal Enigma]\n\n== License\n\n* https://www.apache.org/licenses/LICENSE-2.0[Apache License 2.0]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmp911de%2Fenigma4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmp911de%2Fenigma4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmp911de%2Fenigma4j/lists"}