{"id":18731378,"url":"https://github.com/christopher-besch/cryptography","last_synced_at":"2025-08-12T00:05:51.175Z","repository":{"id":110971480,"uuid":"320073300","full_name":"christopher-besch/cryptography","owner":"christopher-besch","description":"Cryptography Cracking Tool.","archived":false,"fork":false,"pushed_at":"2021-05-22T19:44:41.000Z","size":10296,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T22:41:11.923Z","etag":null,"topics":["ciphers","cryptography","cut","decryption","delimiters","encrypted-numbers","xor"],"latest_commit_sha":null,"homepage":"","language":"C++","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/christopher-besch.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}},"created_at":"2020-12-09T20:36:32.000Z","updated_at":"2024-12-23T14:02:07.000Z","dependencies_parsed_at":"2023-03-13T13:45:07.533Z","dependency_job_id":null,"html_url":"https://github.com/christopher-besch/cryptography","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/christopher-besch/cryptography","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopher-besch%2Fcryptography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopher-besch%2Fcryptography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopher-besch%2Fcryptography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopher-besch%2Fcryptography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christopher-besch","download_url":"https://codeload.github.com/christopher-besch/cryptography/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopher-besch%2Fcryptography/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269976788,"owners_count":24506466,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ciphers","cryptography","cut","decryption","delimiters","encrypted-numbers","xor"],"created_at":"2024-11-07T14:57:28.610Z","updated_at":"2025-08-12T00:05:51.166Z","avatar_url":"https://github.com/christopher-besch.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔒Cryptography\n\nThis repository contains two command line applications, `encryption` and `decryption`.\nBoth programs are designed to be executed from the command line.\n\n## Encryption\n\n`encryption` encrypts the input using one of the supported algorithms.\nTo select the desired algorithm, the parameter `-a \u003calgorithm name\u003e` or `--algorithm \u003calgorithm name\u003e` shall be used.\nEach algorithm uses certain settings/keys.\nIf a value for one of these settings is supplied as a command line parameter, only this value for this setting will be used.\nIf the setting is not supplied, all possible values for this setting will be used in succession, returning multiple different ciphers.\n\nThe input text can be supplied as the first parameter (otherwise the user has to input it later on).\n\n### Algorithms\n\n- `xor`:\n  - `-k \u003ckey\u003e` or `--key \u003ckey\u003e`: each number (representing a single character using ASCII) get xored with this number\n  - `-b \u003cbase\u003e` or `--base \u003cbase\u003e`: sets base, every encrypted number shall be represented in\n  - `-d \u003cdelimiter\u003e` or `--delim \u003cdelimiter\u003e`: if not supplied, the encrypted numbers won't be separated, if the `\u003cdelimiter\u003e` is omitted, a space will be used\n  - `-o`: when set, each encrypted number will have the same length (0s will be used as a padding)\n- `plow`:\n  - `-k \u003ckey\u003e`: sets the width of the array, the input gets read into\n- `transpose`:\n  - `-k \u003ckey\u003e`: sets the width of the array, the input gets read into\n- `fence`\n\n### Example\n\nThese examples are from linux, windows users have to replace `./encryption` with `encryption.exe`.\n\n```\n./encryption \"Hello World!\" -a xor -b 16 -k 42 -0 -d\n```\n\nThis command returns the cipher `62 4f 46 46 45 0a 7d 45 58 46 4e 0b` using the xor encryption algorithm with the key 42. The encrypted characters are represented in base-16 (hex), separated with spaces and padded with 0s.\n\n```\n./encryption \"Hello World!\" -a xor -b 16 -0 -d\n```\n\nThis command does the same as the one prior with the difference that all possible keys (0-255) are used in succession.\n\n## Decryption\n\n`decryption` is able to decrypt certain ciphers automatically.\nThe user gives the program as much information as she has and it tries its best to decrypt the entered cipher.\nThe program uses brute force by default, creating all decryptions using all possible settings and decryption algorithms.\nEach decrypted string gets a score based on its human comprehensibility.\nTo determine the score of a given string, a dictionary of English and German words is being used.\nThe user is able to add custom words into `user_dict.dic` in the `resource` folder.\nThus anything that can't be found in the dictionaries, like links or telephone numbers, will receive bad scores.\nThat's why this program won't be able to automatically decrypt these, manual decryption is necessary in this case.\nThe user can use the `-m 0` parameter and redirect the output into a file to achieve that.\n\nThe input cipher can be supplied as the first parameter (otherwise the user has to input it later on).\n\nThese parameters are supported with all algorithms:\n\n- `-a \u003calgorithms...\u003e` or `--algorithm \u003calgorithms...\u003e`: This can be set to `xor` and/or `transform`\n- `-m \u003camount\u003e` or `--amount \u003camount\u003e`: By default the program returns the best decryptions it can find.\n  With this parameter only a certain amount of decryptions will be generated.\n  (`0` will print all found decryptions.)\n- `-f \u003cinput_file_path\u003e \u003coutput_file_path\u003e` or `--file \u003cinput_file_path\u003e \u003coutput_file_path\u003e`: When this flag is used, each line from `\u003cinput_file_path\u003e` will be treated as an individual cipher and decrypted into `\u003coutput_file_path\u003e`.\n  Every line can use a different algorithm / settings.\n\n### XOR\n\nThe program starts by separating the cipher into individual encrypted numbers.\nThere are two ways of doing this:\n\n1. Search for characters that can't be decrypted (like spaces) and cut at those delimiters. \u003c- requires delimiter\n2. Ignore all of these possible delimiters and cut into numbers of equal length. \u003c- requires encrypted numbers to be of equal length\n\nThe program will perform both of these methods (unless ordered not to), which may lead to the decrypted text being returned twice.\n\nIt will use all possible values for each setting unless otherwise specified.\nThese are the supported parameters:\n\n- `-d \u003cdelimiters...\u003e` or `--delim \u003cdelimiters...\u003e`: Only these supplied delimiters will be used to split the encrypted numbers.\n  The program won't attempt to separate the cipher with the length of the encrypted numbers, unless explicitly requested.\n- `-l \u003clengths...\u003e` or `--len \u003clengths...\u003e`: Only these encrypted numbers lengths will be used.\n  Analogue to the delimiters, all delimiters are getting ignored if not explicitly requested.\n- `-b \u003cbases...\u003e` or `--base \u003cbases...\u003e`: If this parameter is used, only these bases will be tested.\n- `-k \u003ckeys...\u003e` or `--key \u003ckeys...\u003e`: Only these keys will be tested if supplied.\n\n### Transformation\n\nThis implements multiple decryption algorithms (plow, transpose and fence).\n\nThe cipher gets read into a 2D array row by row.\nThe widths of the array that shall be tested can be specified with `-k \u003ckeys...\u003e` or `--key \u003ckeys...\u003e`.\nEach algorithm is characterized by a certain transformation used on the 2D array.\nOnce that is done, the transformed 2D array gets read row by row.\n\nThe used transformation can be specified with `-t \u003ctransformations...\u003e` or `--transform \u003ctransformations...\u003e`.\n`plow` and `transpose` are supported.\n\nFence decryption can be achieved by using a transpose transformation with half the length of the cipher as key, rounded up.\n\n### Example\n\nThese examples are from linux, windows users have to replace `./decryption` with `decryption.exe`.\n\n```\n./decryption \"HloWrdel ol\"\n```\n\nIn this case the user doesn't know anything about the used encryption process, thus no parameters are supplied.\n\n```\n./decryption \"HloWrdel ol\" -a transform -t transpose -k 6\n```\n\nThis cipher has been created using the fence encryption and has the length 11.\nTherefore the transform algorithm with the transpose transformation can be used with the key 6.\n\n# Download\n\nThe latest build for both linux and windows can be downloaded [here](https://github.com/christopher-besch/cryptography/releases/latest).\n\n## How to Build?\n\nThis repository uses [premake5](https://github.com/premake/premake-core/wiki) as its build system.\nTherefore premake5 can be used to create e.g. Makefiles, Visual Studio .sln and .vcxproj files, etc...\nOnce the files for the compiler of your liking have been created, you can use that compiler to build the projects.\n\n# Implementation Details\n\nThis repository consists of three projects, [encryption](encryption), [decryption](decryption) and [utils](utils).\n\n## [utils](utils)\n\nThis is a statically linked library containing:\n\n- an abstraction layer for console arguments,\n- an implementation of the [Trie](https://en.wikipedia.org/wiki/Trie) data structure\n- string transformation functionality used for both encrypting and decrypting transformation ciphers and\n- generally useful preprocessor macros and functions.\n\n# Resources\n\n- [english.dic](https://github.com/LordHypersonic/C-Spell-Checker)\n- [german1.dic](https://sourceforge.net/projects/germandict/)\n- [german2.dic](https://sourceforge.net/p/germandict/code/HEAD/tree/variants.dic)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopher-besch%2Fcryptography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristopher-besch%2Fcryptography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopher-besch%2Fcryptography/lists"}