{"id":21347067,"url":"https://github.com/yann39/one-time-pad-encryptor","last_synced_at":"2025-03-16T03:44:26.502Z","repository":{"id":223737424,"uuid":"753069114","full_name":"Yann39/one-time-pad-encryptor","owner":"Yann39","description":"Java Swing application to demonstrate one-time pad encryption","archived":false,"fork":false,"pushed_at":"2024-02-21T19:48:06.000Z","size":951,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T00:42:00.131Z","etag":null,"topics":["encryption","java","lfsr","one-time-pad","onetimepad","swing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yann39.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2024-02-05T12:09:18.000Z","updated_at":"2024-02-21T19:53:30.000Z","dependencies_parsed_at":"2024-02-21T20:48:10.330Z","dependency_job_id":null,"html_url":"https://github.com/Yann39/one-time-pad-encryptor","commit_stats":null,"previous_names":["yann39/one-time-pad-encryptor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yann39%2Fone-time-pad-encryptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yann39%2Fone-time-pad-encryptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yann39%2Fone-time-pad-encryptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yann39%2Fone-time-pad-encryptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yann39","download_url":"https://codeload.github.com/Yann39/one-time-pad-encryptor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822277,"owners_count":20353499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["encryption","java","lfsr","one-time-pad","onetimepad","swing"],"created_at":"2024-11-22T02:12:32.267Z","updated_at":"2025-03-16T03:44:26.485Z","avatar_url":"https://github.com/Yann39.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# One-time pad encryption\n\nBasic **Java Swing** application to demonstrate **one-time pad** encryption.\n\n![Version](https://img.shields.io/badge/Version-1.0.0-2AAB92.svg)\n![Static Badge](https://img.shields.io/badge/Last%20update-12%20Nov%202008-blue)\n![Version](https://img.shields.io/badge/Java-6-red.svg)\n\n---\n\n# Table of Contents\n\n* [About the project](#about-the-project)\n* [Usage](#usage)\n* [Technical details](#technical-details)\n* [Architecture](#architecture)\n* [Performances test](#performances-test)\n* [License](#license)\n\n# About the project\n\n\u003cimg alt=\"Java logo\" src=\"doc/logo-java.svg\" height=\"92\"/\u003e\n\nThis is a simple GUI application (in French) to demonstrate the use of the **One-time pad** encryption technique for\nencrypting / decrypting data (text and files).\n\nApplication has been built on **November 2008** using **Netbeans IDE 6.5**.\n\nIt uses the **Swing Application Framework** and was compiled with **Java 6**.\n\n# Usage\n\nRun the provided `.jar` file :\n\n```bash\njava -jar \"dist/ProjetCrypto.jar\"\n```\n\nThen just use the UI :\n\n![Main interface picture](doc/main_interface.png?raw=true \"Main interface\")\n\n![Details interface picture](doc/details_interface.png?raw=true \"Details interface\")\n\nFrom the `Option` menu, you can configure :\n\n- byte packet size (1024, 2048, 4096) : byte packet size for file processing\n- random or fixed seed (alternated 0 and 1)\n- write seed or not : if yes, seed will be written in the mask before generating next bits\n- LFSR (see technical details below)\n\nWhen dealing with files, I use the following naming convention :\n\n- original file : _filename_.ext\n- encrypted file : crypte\\__filename_.ext\n- key file : cle\\__filename_.ext\n- decrypted file : decrypte\\__filename_.ext\n\n# Technical details\n\nSecurity is done by using a **Verman** type scheme with a **Linear Feadback Shift Register** (LFSR) based on a **pseudo-random generator**.\n\nFollowing **LFSR** have been implemented :\n\n1. ```\n   Xn = Xn-5 ⊕ Xn-6 ⊕ Xn-15 ⊕ Xn-16\n   ```\n\n   Short secret key (the seed) is constituted of `X0, X1, ..., X15` values (16 bits)\n\n2. ```\n   Vn = Vn-5 ⊕ Vn-13 ⊕ Vn-17 ⊕ Vn-25\n   Xn = Xn-7 ⊕ Xn-15 ⊕ Xn-19 ⊕ Xn-31\n   Yn = Yn-5 ⊕ Yn-9 ⊕ Yn-29 ⊕ Yn-33\n   Zn = Zn-3 ⊕ Zn-11 ⊕ Zn-35 ⊕ Zn-39\n   ```\n\n   In this case, the secret key consists of `25 + 31 + 33 + 39 = 128` bits, and the secret bit generated\n   after each iteration is given by `b = Vn ⊕ Xn ⊕ Yn ⊕ Zn`.\n\n3. ```\n   Xn = Xn-5 ⊕ Xn-13 ⊕ Xn-17 ⊕ Xn-25 ⊕ Xn-32 ⊕ Xn-40 ⊕ Xn-44 ⊕ Xn-56 ⊕ Xn-61 ⊕ Xn-65 ⊕ Xn-85 ⊕ Xn-89 ⊕ Xn-92 ⊕ Xn-100 ⊕ Xn-124 ⊕ Xn-128\n   ```\n\n   Short secret key (the seed) is constituted of `X0, X1, ..., X127` values (128 bits)\n\nThus, a sequence of bits of the same length as the message to be encrypted will be generated.\nAnd as the data is in binary form, the method is reduced to a particularly simple calculation and very effective in practice.\nThe message to be encrypted is presented as a sequence of bits, and the key is another sequence of bits, of the same length.\nThe bits of the plain text are treated one by one, by combining each one with the bit that has the same rank in the key, and then applying a **XOR** operation.\n\nDecryption is done by combining the encrypted data with the bits of the key.\nThe XOR operation being simple in computer science, these treatments can be performed at very high speed.\n\nHere is a picture representing the secret bit generation for the **128 bits LFSR** (n°2) :\n\n![Secret bit generation picture](doc/secret_bit_generation.png?raw=true \"Secret bit generation\")\n\n# Architecture\n\nApplication architecture :\n\n![Application architecture schema](doc/architecture.png?raw=true \"Architecture\")\n\nAll interesting stuff is located in file `ProjetCryptoView.java` (yes I don't used any **MVC** pattern at that time!)\n\n# Performances test\n\nHere are some tests about file encryption (text, image, sound, video) under different computers (1,2 and 4 cores) to evaluate the performances :\n\n1. Computer 1 (laptop) :\n    - AMD Athlon M 2600+\\@2,0ghz\n    - 1 x 256Mo PC2700@133mhz\n    - 30Go IDE 5400tr/min 2Mo\n2. Computer 2 :\n    - Intel Core 2 duo E6700@3,3ghz\n    - Corsair 2 x 1Go PC6400PRO@413mhz 4-4-4-12\n    - 2 x Maxtor SATA II 160Go 7200tr/min 8Mo raid0\n3. Computer 3 :\n    - Intel Quad Core Q6600@2,9ghz\n    - Corsair 2 x 1Go PC6400C4@406mhz 5-5-5-18\n    - 2 x Maxtor SATA II 500Go 7200tr/min 32Mo raid1\n\nFiles :\n\n- Name : `test1.txt`, Type : `text txt`, Size : `790 bytes`\n- Name : `test2.jpg`, Type : `image jpg`, Size : `46 467 bytes`\n- Name : `test3.mp3`, Type : `sound mp3`, Size : `3 637 961 bytes`\n- Name : `test4.avi`, Type : `video avi`, Size : `310 971 920 bytes`\n\nComputer 1 :\n\n| File                  | LFSR n°1 - 1024 bytes | LFSR n°1 - 2048 bytes | LFSR n°1 - 4096 bytes | LFSR n°2 - 1024 bytes | LFSR n°2 - 2048 bytes | LFSR n°2 - 4096 bytes |\n|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|\n| test1.txt (790 o)     | 00:00:00:080          | 00:00:00:040          | 00:00:00:020          | 00:00:00:010          | 00:00:00:020          | 00:00:00:020          |\n| test2.jpg (46,47 Ko)  | 00:00:00:231          | 00:00:00:180          | 00:00:00:341          | 00:00:00:421          | 00:00:00:430          | 00:00:00:431          |\n| test3.mp3 (3,64 Mo)   | 00:00:06:099          | 00:00:07:370          | 00:00:08:562          | 00:00:10:435          | 00:00:12:938          | 00:00:16:053          |\n| test4.avi (310,97 Mo) | 00:10:50:726          | 00:12:28:306          | 00:14:03:764          | 00:16:51:624          | 00:24:21:078          | 00:29:52:878          |\n\nComputer 2 :\n\n| File                  | LFSR n°1 - 1024 bytes | LFSR n°1 - 2048 bytes | LFSR n°1 - 4096 bytes | LFSR n°2 - 1024 bytes | LFSR n°2 - 2048 bytes | LFSR n°2 - 4096 bytes |\n|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|\n| test1.txt (790 o)     | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          |\n| test2.jpg (46,47 Ko)  | 00:00:00:032          | 00:00:00:050          | 00:00:00:062          | 00:00:00:063          | 00:00:00:062          | 00:00:00:078          |\n| test3.mp3 (3,64 Mo)   | 00:00:01:375          | 00:00:01:782          | 00:00:02:078          | 00:00:02:344          | 00:00:02:938          | 00:00:03:640          |\n| test4.avi (310,97 Mo) | 00:02:15:875          | 00:02:36:265          | 00:02:58:688          | 00:03:33:532          | 00:04:28:391          | 00:05:57:500          |\n\nComputer 3 :\n\n| File                  | LFSR n°1 - 1024 bytes | LFSR n°1 - 2048 bytes | LFSR n°1 - 4096 bytes | LFSR n°2 - 1024 bytes | LFSR n°2 - 2048 bytes | LFSR n°2 - 4096 bytes |\n|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|-----------------------|\n| test1.txt (790 o)     | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          | 00:00:00:000          |\n| test2.jpg (46,47 Ko)  | 00:00:00:016          | 00:00:00:062          | 00:00:00:078          | 00:00:00:047          | 00:00:00:063          | 00:00:00:109          |\n| test3.mp3 (3,64 Mo)   | 00:00:01:563          | 00:00:02:062          | 00:00:02:735          | 00:00:02:859          | 00:00:03:906          | 00:00:04:828          |\n| test4.avi (310,97 Mo) | 00:02:38:112          | 00:02:59:754          | 00:03:38:968          | 00:04:08:622          | 00:05:10:354          | 00:06:58:720          |\n\n# License\n\n[General Public License (GPL) v3](https://www.gnu.org/licenses/gpl-3.0.en.html)\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU\nGeneral Public License as published by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\neven the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program. If not,\nsee \u003chttp://www.gnu.org/licenses/\u003e.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyann39%2Fone-time-pad-encryptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyann39%2Fone-time-pad-encryptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyann39%2Fone-time-pad-encryptor/lists"}