{"id":21590576,"url":"https://github.com/anishlearnstocode/des","last_synced_at":"2025-07-14T22:35:39.654Z","repository":{"id":98361323,"uuid":"290738372","full_name":"anishLearnsToCode/DES","owner":"anishLearnsToCode","description":"The full fledged Data Encryption Standard (DES) 🔐 Algorithm implimented in Python 3 🐍 with detailed explanation and API in Jupyter Notebook 📗.","archived":false,"fork":false,"pushed_at":"2025-03-21T17:46:14.000Z","size":29,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T22:11:27.104Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anishLearnsToCode.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-08-27T09:50:55.000Z","updated_at":"2025-03-21T17:46:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"e519577e-a6ba-4426-b732-8ab55439c593","html_url":"https://github.com/anishLearnsToCode/DES","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anishLearnsToCode/DES","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishLearnsToCode%2FDES","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishLearnsToCode%2FDES/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishLearnsToCode%2FDES/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishLearnsToCode%2FDES/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anishLearnsToCode","download_url":"https://codeload.github.com/anishLearnsToCode/DES/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishLearnsToCode%2FDES/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265361386,"owners_count":23752913,"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":[],"created_at":"2024-11-24T16:19:12.874Z","updated_at":"2025-07-14T22:35:39.611Z","avatar_url":"https://github.com/anishLearnsToCode.png","language":"Jupyter Notebook","readme":"# 🗝 DES (Data Encryption Standard)\n\n![made-with-python](https://img.shields.io/badge/Made%20with-Python%203-1f425f.svg)\n\n## Introduction\nThe __Data Encryption Standard (DES)__ is a symmetric-key block cipher published by the __National Institute of \nStandards and Technology (NIST)__. Here, DES has been implemented in Python 3 with no other dependencies. A full \nexplanation of the cipher along with the Code can be seen in this\n[Jupyter Notebook](notebook/data-encryption-standard-des.ipynb).\n\nThe DES structure uses many smaller Ciphers such as the single Round Fiestel Cipher, which in turn uses the\nsingle Swapper and Mixer Ciphers. All of these smaller constructs have lso been built in individual classes and these\nsmaller constructs have been composed together to form the DES Algorithm.   \n\nThese smaller Ciphers can also be used individual or composed together to create different Ciphers. These building \nblocks are:\n\n- [P-Boxes (Permutation Boxes)](des/PBox.py)\n- [S-Boxes (Substitution Boxes)](des/SBox.py)\n- [Swapper Cipher](des/Swapper.py)\n- [Mixer Cipher](des/Mixer.py)\n- [Single Round Fiestel Cipher](des/Round.py)\n- [DES (Data Encryption Standard)](des/DES.py)\n\n## Running it Locally\nClone this repository on your machine and enter directory. \n```powershell\ngit clone https://github.com/anishLearnsToCode/DES.git\ncd DES\n```\nRun the `driver.py` program to see the output of a number being encrypted and decrypted using\nDES.\n\n```powershell\npython driver.py\n```\n\n```shell script\nNumber: 123456\nEncrypted: 7349708071395271833\nDecrypyed 123456\n```\n\nThe DES algorithm also offers more API endpoints.\n\n## Using the API\n\n### 1. `.encrypt(binary: str) -\u003e str`\nThis method takes in a binary string with 64 bits and will return a binary encrypted string with\n64 bits.\n\n```python\nfrom des import DES\nfrom des.utils import *\n\ndes = DES(key=13)\nciphertext = des.encrypt(int_to_bin(12345, block_size=64))\ndecrypted_binary = des.decrypt(ciphertext)\nprint('Decrypted:', int(decrypted_binary, base=2))\n``` \n\n### 2. `.encrypt_number(number: int) -\u003e int`\nThis takes in a 4 Byte unsigned number and returns a 64 bit unsigned encrypted value.\n\n```python\nfrom des import DES\nfrom des.utils import *\n\ndes = DES(key=13)\nciphertext = des.encrypt_number(12345)\ndecrypted = des.decrypt_number(ciphertext)\nprint('Decrypted:', decrypted)\n```\n\n### 3. `.encrypt_message(message: str) -\u003e list[int]`\nThis method takes in a string (character sequence) and returns a list of integers where every \ninteger in the list is an encrypted 64 bit unsigned version of every character in the message\nstring.\n\n```python\nfrom des import DES\nfrom des.utils import *\n\ndes = DES(key=13)\nciphertext = des.encrypt_message('hello world 👋')\ndecrypted = des.decrypt_message(ciphertext)\nprint('Decrypted:', decrypted)\n```\n\n## References\n1. [Data Encryption Standard ~ Wikipedia](https://en.wikipedia.org/wiki/Data_Encryption_Standard)\n1. [Data Encryption Standard ~ TutorialsPoint](https://www.tutorialspoint.com/cryptography/data_encryption_standard.htm)\n1. [Cryptography and Network Security ~ Behrouz A. Forouzan](https://books.google.co.in/books?id=OYiwCgAAQBAJ)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanishlearnstocode%2Fdes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanishlearnstocode%2Fdes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanishlearnstocode%2Fdes/lists"}