{"id":16960831,"url":"https://github.com/carleslc/crypttools","last_synced_at":"2025-03-22T14:30:53.184Z","repository":{"id":72487097,"uuid":"103764226","full_name":"Carleslc/CryptTools","owner":"Carleslc","description":"Tools for encryption, decryption and cracking from several cryptographic systems.","archived":false,"fork":false,"pushed_at":"2023-02-22T01:46:41.000Z","size":62,"stargazers_count":37,"open_issues_count":0,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-01T16:22:23.743Z","etag":null,"topics":["aes","analysis","caesar","chryptology","cipher","classical-cryptography","crack","cryptographic","cryptographic-systems","cryptography","decryption","encryption","file","key","scytale","statistics","text","vigenere"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/Carleslc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"carleslc"}},"created_at":"2017-09-16T15:50:45.000Z","updated_at":"2024-10-30T13:06:58.000Z","dependencies_parsed_at":"2023-02-23T07:15:34.518Z","dependency_job_id":null,"html_url":"https://github.com/Carleslc/CryptTools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carleslc%2FCryptTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carleslc%2FCryptTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carleslc%2FCryptTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Carleslc%2FCryptTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Carleslc","download_url":"https://codeload.github.com/Carleslc/CryptTools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244216271,"owners_count":20417587,"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":["aes","analysis","caesar","chryptology","cipher","classical-cryptography","crack","cryptographic","cryptographic-systems","cryptography","decryption","encryption","file","key","scytale","statistics","text","vigenere"],"created_at":"2024-10-13T22:50:18.740Z","updated_at":"2025-03-22T14:30:53.178Z","avatar_url":"https://github.com/Carleslc.png","language":"Python","readme":"# CryptTools\n\nTools for encryption, decryption and cracking from several cryptographic systems.\n\n🇪🇸 Obtén información sobre la criptografía clásica y este proyecto en [este artículo](https://blog.carleslc.me/criptografia-clasica-con-python/).\n\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/carleslc)\n\n- [How to Install](#how-to-install)\n- [Tools available](#tools-available)\n  - [Caesar](#caesar)\n      - [Usage](#usage)\n        - [Examples](#examples)\n          - [Encrypt a text and save to a file](#encrypt-a-text-and-save-to-a-file)\n          - [Encrypt with extra information](#encrypt-with-extra-information)\n          - [Decrypt with a known key](#decrypt-with-a-known-key)\n          - [Decrypt without knowing the key](#decrypt-without-knowing-the-key)\n          - [Advanced features](#advanced-features)\n      - [NOTE](#note)\n  - [Scytale](#scytale)\n      - [Usage](#usage-1)\n        - [Examples](#examples-1)\n          - [Encrypt a text and save to a file](#encrypt-a-text-and-save-to-a-file-1)\n          - [Encrypt with extra information](#encrypt-with-extra-information-1)\n          - [Decrypt with a known key](#decrypt-with-a-known-key-1)\n          - [Decrypt without knowing the key](#decrypt-without-knowing-the-key-1)\n          - [Advanced features](#advanced-features-1)\n      - [NOTE](#note-1)\n  - [Vigenère](#vigenère)\n      - [Usage](#usage-2)\n        - [Examples](#examples-2)\n          - [Encrypt a text and save to a file](#encrypt-a-text-and-save-to-a-file-2)\n          - [Encrypt with extra information](#encrypt-with-extra-information-2)\n          - [Decrypt with a known key](#decrypt-with-a-known-key-2)\n          - [Decrypt without knowing the key](#decrypt-without-knowing-the-key-2)\n          - [Advanced features](#advanced-features-2)\n      - [NOTE](#note-2)\n  - [AES](#aes)\n      - [Usage](#usage-3)\n        - [Examples](#examples-3)\n          - [Encrypt and save to a file](#encrypt-and-save-to-a-file)\n          - [Decrypt with a known key](#decrypt-with-a-known-key-3)\n          - [Advanced features](#advanced-features-3)\n\n## How to Install\n\n1. Install **[Python 3.6](https://www.python.org/downloads/)** if you do not have it yet.\n2. Ensure that you have installed **python3.6** in **/usr/bin** otherwise you will need to make a symbolic link to its real location:\n```\nsudo ln -s $(which python3.6) /usr/bin/python3.6\n```\n3. Install the following Python dependencies:\n```\npip3 install numpy\npip3 install pyenchant\n```\n4. Clone this repository: `git clone https://github.com/Carleslc/CryptTools.git`\n5. Give execution permissions to all tools:\n```\ncd CryptTools/tools\nchmod +x *\n```\n\n## Tools available\n\n_These tools are designed to be useful in the field of computer security and their use is restricted to personal use or under consent. I am not responsible for any illicit use that may occur._\n\n### Caesar\n\n[--\u003e What is the Caesar Cipher? \u003c--](https://en.wikipedia.org/wiki/Caesar_cipher)\n\n#### Usage\n\n`./caesar.py --help`\n```\nusage: caesar.py [-h] [-t TEXT] [-k KEY] [-l LANG] [-V] [-A] [-D]\n                 [-T THRESHOLD] [--beep]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t TEXT, --text TEXT  text to read from. If not specified the program will\n                        read from standard input\n  -k KEY, --key KEY     key used to encrypt. If no key is provided the program\n                        will try to crack and decrypt using the specified\n                        language\n  -l LANG, --lang LANG  available languages: ['de_DE', 'en_AU', 'en_GB',\n                        'en_US', 'fr_FR'] (default: en_US). Only useful if no\n                        key is provided\n  -V, --verbose         show extra information\n  -A, --all             show decrypted text for each tested key\n  -D, --debug           show information about text validation\n  -T THRESHOLD, --threshold THRESHOLD\n                        valid word count percentage to mark the whole text as\n                        valid language (default: 50)\n  --beep                plays a beep sound when program finishes. May require\n                        SOX to be installed\n```\n\n##### Examples\n\n###### Encrypt a text and save to a file\n\n**`./caesar.py -t \"This is the Caesar tool from CryptTools!\" -k 5 \u003e test`**\n```\nYmnx nx ymj Hfjxfw yttq kwtr HwduyYttqx!\n```\n\n`-t` argument is not mandatory, so if you need to encrypt a long text you can skip it, execute `./caesar.py -k 5 \u003e test` and then paste your text. When completed press `Return` and then finish the input with `Ctrl+D` so the program will read it.\n\n###### Encrypt with extra information\n\n**`./caesar.py -t \"This is the Caesar tool from CryptTools!\" -k 5 -VA`**\n```\nOriginal text most frequent character: t\n\nYmnx nx ymj Hfjxfw yttq kwtr HwduyYttqx!\n\nEncrypted text most frequent character: y\n```\n\n###### Decrypt with a known key\n\nTo decrypt you will need to know the shift needed to reallocate each character to its correct character in the alphabet. In the example above the encrypted shift is 5 so the shift needed to decrypt is 26 - 5 = 21, where 26 is the size of the alphabet.\n\n**`./caesar.py -k 21 \u003c test`**\n```\nThis is the Caesar tool from CryptTools!\n```\n\n###### Decrypt without knowing the key\n\nThis method cracks the message with bruteforce and then checks every result validating the language to guess which result is the original text. By default language is English, for other languages read below.\n\n**`./caesar.py \u003c test`**\n```\nThis is the Caesar tool from CryptTools!\n```\n\n###### Advanced features\n\nRead from a file and print cracked keys:\n\n**`./caesar.py -V \u003c test`**\n```\nMost frequent character: y\nTesting 't' (ROT-21)       SUCCESS\nDecrypted with ROT-21. Original encryption key: 5\nThis is the Caesar tool from CryptTools!\n```\n\nROT-X means that each character in the text is shifted X positions in the alphabet.\n\nTo decrypt a message without knowing the key you need to know the original text **language**. It is provided with `--lang` option. By default it is `en_US` (American English).\n\nFor example, in _Deutsch_ language:\n\n`./caesar.py -t \"Dies ist das Scytale-Tool von CryptTools!\" -k 6`\n```\nJoky oyz jgy Yiezgrk-Zuur but IxevzZuury!\n```\n\nIf language is not provided it will try English and it will fail:\n\n**`./caesar.py -V -t \"Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!\"`**\n```\nMost frequent character: y\nTesting 'z' (ROT-1)        \nSorry. None of decrypted results seems to be written in language en_US...\n```\n\nThen, providing the correct language:\n\n**`./caesar.py -V -t \"Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!\" --lang \"de_DE\"`**\n```\nMost frequent character: y\nTesting 's' (ROT-20)       SUCCESS\nDecrypted with ROT-20. Original encryption key: 6\nDies ist das Scytale-Tool von CryptTools!\n```\n\nYou can check all available codes with `./caesar.py --help`. You can even install more languages, for that take a look [here](http://pythonhosted.org/pyenchant/tutorial.html#adding-language-dictionaries).\n\nIf original text _**language is unknown**_ you still can generate all possible transformations, then you will need to check them manually in order to know which is the correct:\n\n**`./caesar.py -V -A -t \"Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!\"`**\n```\nMost frequent character: y\nTesting 'e' (ROT-6)       Testing decrypted text:\n\"Puqe uef pme Eokfmxq-Faax haz OdkbfFaaxe!\"\nTesting 't' (ROT-21)       Testing decrypted text:\n\"Ejft jtu ebt Tdzubmf-Uppm wpo DszquUppmt!\"\n...\nTesting 's' (ROT-20)       Testing decrypted text:\n\"Dies ist das Scytale-Tool von CryptTools!\"\nTesting 'h' (ROT-9)       Testing decrypted text:\n\"Sxth xhi sph Hrnipat-Idda kdc RgneiIddah!\"\n...\nTesting 'q' (ROT-18)       Testing decrypted text:\n\"Bgcq gqr byq Qawryjc-Rmmj tml ApwnrRmmjq!\"\nTesting 'z' (ROT-1)       Testing decrypted text:\n\"Kplz pza khz Zjfahsl-Avvs cvu JyfwaAvvsz!\"\n\nSorry. None of decrypted results seems to be written in language en_US...\n```\n\nTesting order is frequency order (most common letter is tested first).\n\nIn addition, with the extra option `-D` you can check the language validation process:\n\n**`./caesar.py -VAD \u003c test`**\n```\nMost frequent character: y\nTesting 'e' (ROT-6)       Testing decrypted text:\n\"Estd td esp Nlpdlc ezzw qczx NcjaeEzzwd!\"\n\nestd: False              |  Progress 0%     | Max 88%\ntd: False                |  Progress 0%     | Max 75%\nesp: True                |  Progress 12%    | Max 75%\nnlpdlc: False            |  Progress 12%    | Max 62%\nezzw: False              |  Progress 12%    | Max 50%\nqczx: False              |  Progress 12%    | Max 38%\n\nTesting 't' (ROT-21)       Testing decrypted text:\n\"This is the Caesar tool from CryptTools!\"\n\nthis: True               |  Progress 12%    | Max 100%\nis: True                 |  Progress 25%    | Max 100%\nthe: True                |  Progress 38%    | Max 100%\ncaesar: False            |  Progress 38%    | Max 88%\ntool: True               |  Progress 50%    | SUCCESS\n\nDecrypted with ROT-21. Original encryption key: 5\nThis is the Caesar tool from CryptTools!\n```\n\n`-A` and `-D` options may be too verbose, avoid using them for long texts.\n\nYou can also set the permissiveness of the language validation process with the `--threshold -T` option. By default it is set to 50 (half of the text words must be written in the specified language in order to accept it as the original text). Values must be between 1 and 100. Values below 20% are not recommended (an encrypted text may be accepted as decrypted). Higher values indicate toughness, but 100% it is neither recommended (in the text may be non-english nouns and other original but non-english words).\n\n#### NOTE\n\nAs you can see, it is too easy to crack this classical cryptographic system so it is not recommended to use it in production software.\n\n### Scytale\n\n[--\u003e What is a Scytale? \u003c--](https://en.wikipedia.org/wiki/Scytale)\n\n#### Usage\n\n`./scytale.py --help`\n\n```\nusage: scytale.py [-h] [-t TEXT] [-k KEY] [-l LANG] [-V] [-A] [-D]\n                  [-T THRESHOLD] [--beep]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t TEXT, --text TEXT  text to read from. If not specified the program will\n                        read from standard input\n  -k KEY, --key KEY     key used to encrypt. If no key is provided the program\n                        will try to crack and decrypt using the specified\n                        language\n  -l LANG, --lang LANG  available languages: ['de_DE', 'en_AU', 'en_GB',\n                        'en_US', 'fr_FR'] (default: en_US). Only useful if no\n                        key is provided\n  -V, --verbose         show extra information\n  -A, --all             show decrypted text for each tested key\n  -D, --debug           show information about text validation\n  -T THRESHOLD, --threshold THRESHOLD\n                        valid word count percentage to mark the whole text as\n                        valid language (default: 50)\n  --beep                plays a beep sound when program finishes. May require\n                        SOX to be installed\n```\n\n##### Examples\n\n###### Encrypt a text and save to a file\n\n**`./scytale.py -t \"This is the Scytale tool from CryptTools!\" -k 5 \u003e test`**\n```\nTheoohe moi t lsSoCs cor!iyly st p  aft tlrT\n```\n\n`-t` argument is not mandatory, so if you need to encrypt a long text you can skip it, execute `./scytale.py -k 5 \u003e test` and then paste your text. When completed press `Return` and then finish the input with `Ctrl+D` so the program will read it.\n\n###### Encrypt with extra information\n\n**`./scytale.py -t \"This is the Scytale tool from CryptTools!\" -k 5 -VA`**\n```\nTesting matrix: 5x9\nText to cipher: \"This is the Scytale tool from CryptTools!\" (41)\n[['T' 'h' 'i' 's' ' ' 'i' 's' ' ' 't']\n ['h' 'e' ' ' 'S' 'c' 'y' 't' 'a' 'l']\n ['e' ' ' 't' 'o' 'o' 'l' ' ' 'f' 'r']\n ['o' 'm' ' ' 'C' 'r' 'y' 'p' 't' 'T']\n ['o' 'o' 'l' 's' '!' ' ' ' ' ' ' ' ']]\nResult size: 44\nTheoohe moi t lsSoCs cor!iyly st p  aft tlrT\n```\n\nThat matrix represents the Scytale. To encrypt the text it is written by rows (5) and read by columns (9).\n\n###### Decrypt with a known key\n\nTo decrypt you will need to know the columns of the underlying matrix. In the example above they are 9.\nIf you only have the key 5 (rows) then you can calculate the columns with the text size:\n`Columns = Size/Rows`. For example, the encrypted text above has size 44, so 44/5 = 8.8, rounding we have that columns are 9.\n\n**`./scytale.py -k 9 \u003c test`**\n```\nThis is the Scytale tool from CryptTools!\n```\n\n###### Decrypt without knowing the key\n\nThis method cracks the message with bruteforce and then checks every result validating the language to guess which result is the original text. By default language is English, for other languages read below.\n\n**`./scytale.py \u003c test`**\n```\nThis is the Scytale tool from CryptTools!\n```\n\n###### Advanced features\n\nRead from a file and print cracked keys:\n\n**`./scytale.py -V \u003c test`**\n```\nText to crack: \"Theoohe moi t lsSoCs cor!iyly st p  aft tlrT\" (44)\nTesting matrix: 9x5       SUCCESS\nThis is the Scytale tool from CryptTools!\n```\n\nTo decrypt a message without knowing the key you need to know the original text **language**. It is provided with `--lang` option. By default it is `en_US` (American English).\n\nFor example, in _Deutsch_ language:\n\n`./scytale.py -t \"Dies ist das Scytale-Tool von CryptTools!\" -k 6`\n```\nDtcTnTi yo oedtoCosaalrl sl ysi evp!sS-ot\n```\n\nIf language is not provided it will try English and it will fail:\n\n**`./scytale.py -V -t \"DtcTnTi yo oedtoCosaalrl sl ysi evp!sS-ot\"`**\n```\nText to crack: \"DtcTnTi yo oedtoCosaalrl sl ysi evp!sS-ot\" (41)\nTesting matrix: 2x40       Sorry. None of decrypted results seems to be written in language en_US...\n```\n\nThen, providing the correct language:\n\n**`./scytale.py -V -t \"DtcTnTi yo oedtoCosaalrl sl ysi evp!sS-ot\" --lang \"de_DE\"`**\n```\nText to crack: \"DtcTnTi yo oedtoCosaalrl sl ysi evp!sS-ot\" (41)\nTesting matrix: 7x6       SUCCESS\nDies ist das Scytale-Tool von CryptTools!\n```\n\nYou can check all available codes with `./scytale.py --help`. You can even install more languages, for that take a look [here](http://pythonhosted.org/pyenchant/tutorial.html#adding-language-dictionaries).\n\nIf original text _**language is unknown**_ you still can generate all possible transformations, then you will need to check them manually in order to know which is the correct:\n\n**`./scytale.py -V -A -t \"DtcTnTi yo oedtoCosaalrl sl ysi evp!sS-ot\"`**\n```\nText to crack: \"Ddlooiaenoes- ls TCs Sor!icoy sylp tt t  avT\" (44)\n...\nTesting matrix: 2x21       Testing decrypted text:\n\"DltrclT nsTli  yysoi  oeevdpt!osCSo-soata\"\nTesting matrix: 21x2       Testing decrypted text:\n\"Dcniy etCsar lyieps-ttTT oodooalls s v!So\"\nTesting matrix: 3x14       Testing decrypted text:\n\"DtytoscCiTo nseTaviap l!yrsolS  -osoeltd\"\nTesting matrix: 14x3       Testing decrypted text:\n\"DTioeosl  ivsotn  dCarsy pStcTyotoallse!-\"\n...\nTesting matrix: 9x5       Testing decrypted text:\n\"DT oasi!ttioCll s c eor eS Tydslyv- nota spo\"\nTesting matrix: 6x7       Testing decrypted text:\n\"D tly!tyorsscoCliST o  -nosseoTealvtida p\"\nTesting matrix: 7x6       Testing decrypted text:\n\"Dies ist das Scytale-Tool von CryptTools!\"\nTesting matrix: 8x6       Testing decrypted text:\n\"Dies is t das S cytale- Tool vo n Crypt Tools!\"\n...\nTesting matrix: 2x40       Testing decrypted text:\n\"Dtt c T n T i   y o   o e d t o C o s a a l r l   s l   y s i   e v p ! s S - o\"\nSorry. None of decrypted results seems to be written in language en_US...\n```\n\nIn addition, with the extra option `-D` you can check the language validation process:\n\n**`./scytale.py -VAD \u003c test`**\n```\nText to crack: \"Theoohe moi t lsSoCs cor!iyly st p  aft tlrT\" (44)\nTesting matrix: 1x44       Testing decrypted text:\n\"Theoohe moi t lsSoCs cor!iyly st p  aft tlrT\"\n\ntheoohe: False           |  Progress 0%     |   Max 90%\nmoi: False               |  Progress 0%     |   Max 80%\nlssocs: False            |  Progress 0%     |   Max 60%\ncor: False               |  Progress 0%     |   Max 50%\niyly: False              |  Progress 0%     |   Max 40%\n\n...\n\nTesting matrix: 2x22       Testing decrypted text:\n\"Tohre!oioyhley  msoti  pt   lasfSto Ctsl rcT\"\n\ntohre: False             |  Progress 0%     |   Max 86%\noioyhley: False          |  Progress 0%     |   Max 71%\nmsoti: False             |  Progress 0%     |   Max 57%\npt: True                 |  Progress 14%    |   Max 57%\nlasfsto: False           |  Progress 14%    |   Max 43%\n\nTesting matrix: 22x2       Testing decrypted text:\n\"TeoemitlSC o!yys  attrhoh o  soscril tp f lT\"\n\nteoemitlsc: False        |  Progress 0%     |   Max 89%\nyys: False               |  Progress 0%     |   Max 67%\nattrhoh: False           |  Progress 0%     |   Max 56%\n\n...\n\nTesting matrix: 3x15       Testing decrypted text:\n\"TsshSteo oCpos h  eca ofmrto! iit yltlr yTl\"\n\ntsshsteo: False          |  Progress 0%     |   Max 88%\nocpos: False             |  Progress 0%     |   Max 75%\neca: False               |  Progress 0%     |   Max 50%\nofmrto: False            |  Progress 0%     |   Max 38%\n\nTesting matrix: 15x3       Testing decrypted text:\n\"ToeotsCc!lspa rho i Ssoiyt ftTehm lo ry   tl\"\n\ntoeotscc: False          |  Progress 0%     |   Max 89%\nlspa: False              |  Progress 0%     |   Max 78%\nrho: True                |  Progress 11%    |   Max 78%\nssoiyt: False            |  Progress 11%    |   Max 56%\nfttehm: False            |  Progress 11%    |   Max 44%\n\n...\n\nTesting matrix: 5x9       Testing decrypted text:\n\"ToClahisyfe   totcs o otthlr les!pr Si Tmoy\"\n\ntoclahisyfe: False       |  Progress 0%     |   Max 88%\ntotcs: False             |  Progress 0%     |   Max 75%\notthlr: False            |  Progress 0%     |   Max 50%\nles: False               |  Progress 0%     |   Max 38%\n\nTesting matrix: 9x5       Testing decrypted text:\n\"This is the Scytale tool from CryptTools!\"\n\nthis: True               |  Progress 12%    |   Max 100%\nis: True                 |  Progress 25%    |   Max 100%\nthe: True                |  Progress 38%    |   Max 100%\nscytale: False           |  Progress 38%    |   Max 88%\ntool: True               |  Progress 50%    |   \nSUCCESS\nThis is the Scytale tool from CryptTools!\n```\n\n`-A` and `-D` options may be too verbose, avoid using them for long texts.\n\nYou can also set the permissiveness of the language validation process with the `--threshold -T` option. By default it is set to 50 (half of the text words must be written in the specified language in order to accept it as the original text). Values must be between 1 and 100. Values below 20% are not recommended (an encrypted text may be accepted as decrypted). Higher values indicate toughness, but 100% it is neither recommended (in the text may be non-english nouns and other original but non-english words).\n\n#### NOTE\n\nAs you can see, it is too easy to crack this classical cryptographic system so it is not recommended to use it in production software.\n\n### Vigenère\n\n[--\u003e What is the Vigenère Cipher? \u003c--](https://en.wikipedia.org/wiki/Vigenère_cipher)\n\n#### Usage\n\n`./vigenere.py --help`\n```\nusage: vigenere.py [-h] [-t TEXT] [-k KEY] [--decrypt] [--exhaustive] [-V]\n                   [-A] [-D] [-T THRESHOLD] [--beep]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t TEXT, --text TEXT  text to read from. If not specified the program will\n                        read from standard input\n  -k KEY, --key KEY     key used to encrypt or decrypt. If no key is provided\n                        the program will try to crack and decrypt the text\n  --decrypt             use the key to decrypt the text. If no key is provided\n                        this argument is redundant\n  --exhaustive          tests all possible keys. If not provided this program\n                        only will test keys below length 100 while cracking\n  -V, --verbose         show extra information\n  -A, --all             show decrypted text for each tested key\n  -D, --debug           show information about text validation\n  -T THRESHOLD, --threshold THRESHOLD\n                        valid word count percentage to mark the whole text as\n                        valid language (default: 50)\n  --beep                plays a beep sound when program finishes. May require\n                        SOX to be installed\n```\n\n##### Examples\n\n###### Encrypt a text and save to a file\n\n**`./vigenere.py -t \"This is the Vigenere tool from CryptTools!\" -k \"CRYPT\" \u003e test`**\n```\nVygh bu kft Okxccxtv rdhn wpdf EiwemVfmal!\n```\n\n`-t` argument is not mandatory, so if you need to encrypt a long text you can skip it, execute `./vigenere.py \"CRYPT\" \u003e test` and then paste your text. When completed press `Return` and then finish the input with `Ctrl+D` so the program will read it.\n\n###### Encrypt with extra information\n\n**`./vigenere.py -t \"This is the Vigenere tool from CryptTools!\" -k \"CRYPT\" -V`**\n```\nKey \"CRYPT\" shifts: [2, 17, 24, 15, 19]\nVygh bu kft Okxccxtv rdhn wpdf EiwemVfmal!\n```\n\n###### Decrypt with a known key\n\nTo decrypt you will need to know the encryption key. In the example above it is _CRYPT_.\nYou need to provide the argument `--decrypt` to use the key to decrypt.\n\n**`./vigenere.py -k \"CRYPT\" --decrypt \u003c test`**\n```\nThis is the Vigenere tool from CryptTools!\n```\n\n###### Decrypt without knowing the key\n\nThis method cracks the message testing with statistical methods and bruteforce and then checks every result validating the language to guess which result is the original text. In comparison to previous methods this will only work if the original text language is **English** because of the statistics methods it is using. In addition, in relation to this it is worth noting that long keys may contain some wrong letters. Given this limitation the maximum key length allowed by default is 100. Nevertheless you can force the program to test all possible key lengths using the argument `--exhaustive`. Also take in account that for small texts this program may fail, as we can see in the example below.\n\n**`./vigenere.py \u003c test`**\n```\nSorry. None of decrypted results seems to be written in language en_US...\nIf you want to try more keys execute this program again with the option --exhaustive. However, it is worth noting that the longer the key is the more errors can have the cracked key. In addition, this program may have difficulties to crack keys on smaller texts in comparison with the key length.\n```\n\nProviding longer texts may be more successful:\n\n_test_:\n```\nThis method cracks the message testing with statistical methods and bruteforce and then checks every result validating the language to guess which result is the original text. In comparison to previous methods this will only work if the original text language is English because of the statistics methods it is using. In addition, in relation to this it is worth noting that long keys may contain some wrong letters. Given this limitation the maximum key length allowed by default is 100. Nevertheless you can force the program to test all possible key lengths using the argument --exhaustive. Also take in account that for small texts this program may fail, as we can see in the example below.\n```\n\n**`./vigenere.py -k \"CRYPT\" \u003c test \u003e test_encrypted`**\n```\nVygh fgkfdw eiyrdu kft fgjqpzg kchmkee lbvy qitvzqiberj bxvymsl ceb qkwkcuhttc pgf kftg eycrdu vttka ichnnk tpekuyibpx rwx nrlvncxc ih ilchl yygra tvqjev zq iag fpxzkeya mgor. Xg efkettzqdg vf ngxxzmjl ovrwhfj rwbu ngae qejn pqii xy vyc dkkxgctn kcmm nrlvncxc xl Geeabuy ztvclqt hh kft lvrrxlvzah fgkfdwu zr xl wjgcz. Ke yswkkgdg, ke pteckgdg vf rwbu zr xl yfpia pfrxgi kfpm nflv dgpq bta tmcmczl hhov ughpx jtmvvph. Zkmcc mjzq abozrpmkfl iag dymbolk zxa ccczvy yaeqncs ua ucutwcr xl 100. Pvttkvycaxuj wdn erl uhttc iag gpdztrk ih vvqi tnc ndluzzax mvw axpxrwl wjgcz vyc pkilktgv --vvwtwjrxog. Rjhh vrit bp rarhwer iack ddk udyae vvvil vygh itfegto dyn yczj, pl yv apg uvc xg vyc tqcdnax dvjdp.\n```\n\n**`./vigenere.py \u003c test_encrypted`**\n```\nThis method cracks the message testing with statistical methods and bruteforce and then checks every result validating the language to guess which result is the original text. In comparison to previous methods this will only work if the original text language is English because of the statistics methods it is using. In addition, in relation to this it is worth noting that long keys may contain some wrong letters. Given this limitation the maximum key length allowed by default is 100. Nevertheless you can force the program to test all possible key lengths using the argument --exhaustive. Also take in account that for small texts this program may fail, as we can see in the example below.\n```\n\n\n###### Advanced features\n\nPrint cracked key and other information about the cracking process:\n\n**`./vigenere.py -V \u003c test_encrypted`**\n```\nText IC (Index of Coincidence): 0.04250925751584761\nFriedman test suggests a key length of 8\nTesting key length 8\nKey \"SRAZSCKX\" shifts: [18, 17, 0, 25, 18, 2, 10, 23]\nKasiki examination\nFinding sequence duplicates and spacings...\n100% \nExtracting spacing divisors...\nTesting key length 5\nKey \"CRYPT\" shifts: [2, 17, 24, 15, 19]\nSUCCESS\nKey: CRYPT\nThis method cracks the message testing with statistical methods and bruteforce and then checks every result validating the language to guess which result is the original text. In comparison to previous methods this will only work if the original text language is English because of the statistics methods it is using. In addition, in relation to this it is worth noting that long keys may contain some wrong letters. Given this limitation the maximum key length allowed by default is 100. Nevertheless you can force the program to test all possible key lengths using the argument --exhaustive. Also take in account that for small texts this program may fail, as we can see in the example below.\n```\n\nPrint even more information:\n\n**`./vigenere.py -VA \u003c test_encrypted`**\n```\nFrequencies: [('v', 39), ('c', 37), ('g', 34), ('k', 32), ('t', 32), ('r', 27), ('x', 26), ('y', 25), ('l', 24), ('e', 23), ('a', 23), ('p', 22), ('z', 22), ('i', 21), ('h', 20), ('f', 20), ('d', 20), ('w', 17), ('u', 17), ('n', 17), ('j', 15), ('q', 15), ('m', 15), ('b', 12), ('o', 7), ('s', 3)]\nText IC (Index of Coincidence): 0.04250925751584761\nFriedman test suggests a key length of 8\nTesting key length 8\nSubgroup 1 (IC: 0.041851106639839035)\nvdkzevbehfuhuxcyjfmkvjjeikmxbqvhzzgcwfglahxzqkmcecparaknaxzkwhrayvgzgcd\nTesting subkey 'A' with match score 57%\nTesting subkey 'B' with match score 56%\n...\nKey \"SRAZSCKX\" shifts: [18, 17, 0, 25, 18, 2, 10, 23]\nKasiki examination\nFinding sequence duplicates and spacings...\n100% \n{'kft': [55, 220, 165], 'rdu': [65], 'vzqi': [90], 'nrlvncxc': [105], 'hfgkfdw': [245], 'rxl': [15, 50, 155, 140, 105], 'zkey': [125], 'kgdg': [10], 'dgvf': [125], 'rwbu': [110], 'uzrxl': [35], 'rxg': [155], 'iag': [230, 290, 60], 'aeq': [200], 'vttk': [320], 'vyc': [210, 270, 60, 355, 145, 85], 'uhttc': [355], 'qit': [400], 'pxrw': [355], 'lwjgcz': [200], 'czvy': [85], 'yae': [130], 'vvv': [40], 'vygh': [520]}\nExtracting spacing divisors...\nKasiki possible key lengths (sorted by probability):\n[5, 10, 2, 4, 15, 20, 3, 7, 11, 35, 40, 6, 25, 30, 55, 9, 13, 14, 50, 65, 16, 18, 21, 22, 26, 29, 45, 70, 80, 90, 100, 12, 17, 23, 27, 28, 31, 32, 33, 42, 44, 46, 49, 52, 54, 58, 60, 64, 71, 85]\nTesting key length 5\nSubgroup 1 (IC: 0.07237673830594185)\nvgeuggkvvevcwtfeuankpnciytvgkgetvxofuqqvknncguchvvguwkkkcvuypingacopvkjokgoavqawpvuetgtvnumpwvivwgvpwcuvvtocyuvcd\nTesting subkey 'A' with match score 53%\nTesting subkey 'B' with match score 54%\nTesting subkey 'C' with match score 69%\nTesting subkey 'D' with match score 54%\nTesting subkey 'E' with match score 53%\nTesting subkey 'F' with match score 46%\nTesting subkey 'G' with match score 60%\nTesting subkey 'H' with match score 54%\nTesting subkey 'I' with match score 58%\nTesting subkey 'J' with match score 52%\nTesting subkey 'K' with match score 54%\nTesting subkey 'L' with match score 55%\nTesting subkey 'M' with match score 52%\nTesting subkey 'N' with match score 59%\nTesting subkey 'O' with match score 58%\nTesting subkey 'P' with match score 52%\nTesting subkey 'Q' with match score 48%\nTesting subkey 'R' with match score 58%\nTesting subkey 'S' with match score 56%\nTesting subkey 'T' with match score 56%\nTesting subkey 'U' with match score 54%\nTesting subkey 'V' with match score 53%\nTesting subkey 'W' with match score 54%\nTesting subkey 'X' with match score 52%\nTesting subkey 'Y' with match score 52%\nTesting subkey 'Z' with match score 51%\nBest subkey is 'C' with match score 69%\n...\nSubgroup 4 (IC: 0.06368520859671302)\nhdrtphliibsquptrthpiwvihrjixaxedgjwwanxdcmvxatttxhdxcsdtdwxixpvbchgthcapimzcasuxtaduidiidaawcptwxhtridaihgnppxtad\nTesting subkey 'A' with match score 63%\nTesting subkey 'B' with match score 58%\nTesting subkey 'C' with match score 53%\nTesting subkey 'D' with match score 57%\nTesting subkey 'E' with match score 59%\nTesting subkey 'F' with match score 57%\nTesting subkey 'G' with match score 57%\nTesting subkey 'H' with match score 57%\nTesting subkey 'I' with match score 55%\nTesting subkey 'J' with match score 56%\nTesting subkey 'K' with match score 60%\nTesting subkey 'L' with match score 56%\nTesting subkey 'M' with match score 54%\nTesting subkey 'N' with match score 51%\nTesting subkey 'O' with match score 58%\nTesting subkey 'P' with match score 77%\nTesting subkey 'Q' with match score 58%\nTesting subkey 'R' with match score 54%\nTesting subkey 'S' with match score 52%\nTesting subkey 'T' with match score 57%\nTesting subkey 'U' with match score 57%\nTesting subkey 'V' with match score 57%\nTesting subkey 'W' with match score 56%\nTesting subkey 'X' with match score 53%\nTesting subkey 'Y' with match score 52%\nTesting subkey 'Z' with match score 53%\nBest subkey is 'P' with match score 77%\nSubgroup 5 (IC: 0.0586283185840708)\nfwdfzmbtbxlkhggdknebxnhlaeazmgtgxlhbepyktmnlbvhllfwlzwgegblagmdtmhhmzmbmabxzeutlkxnhazhtlxxlzkgtohbhakelitylggqxp\nTesting subkey 'A' with match score 56%\nTesting subkey 'B' with match score 54%\n...\nTesting subkey 'R' with match score 54%\nTesting subkey 'S' with match score 62%\nTesting subkey 'T' with match score 75%\nTesting subkey 'U' with match score 56%\nTesting subkey 'V' with match score 52%\nTesting subkey 'W' with match score 51%\nTesting subkey 'X' with match score 58%\nTesting subkey 'Y' with match score 60%\nTesting subkey 'Z' with match score 62%\nBest subkey is 'T' with match score 75%\nKey \"CRYPT\" shifts: [2, 17, 24, 15, 19]\nSUCCESS\nKey: CRYPT\nThis method cracks the message testing with statistical methods and bruteforce and then checks every result validating the language to guess which result is the original text. In comparison to previous methods this will only work if the original text language is English because of the statistics methods it is using. In addition, in relation to this it is worth noting that long keys may contain some wrong letters. Given this limitation the maximum key length allowed by default is 100. Nevertheless you can force the program to test all possible key lengths using the argument --exhaustive. Also take in account that for small texts this program may fail, as we can see in the example below.\n```\n\nIn addition, with the extra option `-D` you can check the language validation process in the same way that with previous cryptographic systems.\n\n`-A` and `-D` options may be too verbose, avoid using them for long texts.\n\nYou can also set the permissiveness of the language validation process with the `--threshold -T` option. By default it is set to 50 (half of the text words must be written in the specified language in order to accept it as the original text). Values must be between 1 and 100. Values below 20% are not recommended (an encrypted text may be accepted as decrypted). Higher values indicate toughness, but 100% it is neither recommended (in the text may be non-english nouns and other original but non-english words).\n\n#### NOTE\n\nAs you can see the choice of the key is important. In order to have a secure encryption you will need to provide a key of at least the length of the text and it needs to be unique for that text. However, nowadays there are many others cryptographic systems more advanced and useful.\n\n### AES\n\n[--\u003e What is the AES Cipher? \u003c--](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)\n\n#### Usage\n\n`./aes.py --help`\n```\nusage: aes.py [-h] [-t TEXT] [-in INFILE] [-out OUTFILE] [-k KEY]\n              [-kf KEYFILE] [-m MODE] [--decrypt]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t TEXT, --text TEXT  text to read from (by default: standard input bytes).\n                        If text contains non-printable characters (special\n                        bytes) then you will need to use --infile and\n                        --outfile in order to do the conversion.\n  -in INFILE, --infile INFILE\n                        file to read from\n  -out OUTFILE, --outfile OUTFILE\n                        file to write the result\n  -k KEY, --key KEY     AES key used to encrypt or decrypt\n  -kf KEYFILE, --keyfile KEYFILE\n                        file containing the AES key used to encrypt or decrypt\n  -m MODE, --mode MODE  operation mode, by default CBC. Supported: ECB, CBC,\n                        CFB, OFB, OPENPGP\n  --decrypt             use the key to decrypt the text\n```\n\n##### Examples\n\n_This examples uses 128-bit key, but you can also use keys with 192 and 256 bits._\n\n###### Encrypt and save to a file\n\n_For text:_\n\n**`./aes.py -t \"This is the AES tool from CryptTools!\" -k \"Sixteen byte key\" -out test.enc`**\n\nBytes:\n```\nb'\\x8f\\x88NP\\x8e^5\u0026\\x95\\x92\u003c\\x9c\\x93s\\xa1D;LP\\x01\\x17\\x83@\\xeb\\x8d\\x7fM\\xbeZ\\xc4\\x10\\x15\\xd8K\\xe2\\x03O\\xa5\\x98\\xcf\\xef\\xc0\\x1c\\x8dg\u003e\\xa62,Gx\\xb9E\\xa7\\xe7\u0026r\\xedb\"\\xf7\\x05+\\x05'\n```\n\n**test.enc**:\n```\nÊ¤Ú@UXK*3p\u001eIR\u000f\u001c„$\u001fbÄÕ\u001aó\u003eŽx \u0017·Ïô5S ªm¹ÿ’z\u003e\u001c3Xe¿\u0006þAÙí\u0005ê€–ÀR{å!vÕ\n```\n\n`-t` argument is not mandatory, so if you need to encrypt a long text you can skip it and paste your text in standard input. When completed press `Return` and then finish the input with `Ctrl+D` so the program will read it.\n\n_For any file format:_\nIn order to encrypt images, binaries and other files you must provide input and output files with `-in` and `-out` parameters.\n\n**`./aes.py -k \"Sixteen byte key\" -in test -out test.enc`**\n\n###### Decrypt with a known key\n\nUse the `--decrypt` parameter.\n\n**`./aes.py -k \"Sixteen byte key\" --decrypt -in test.enc -out test`**\n\n**test**:\n```\nThis is the AES tool from CryptTools!\n```\n\n###### Advanced features\n\nYou can specify a key of 128, 192 or 256 bits which is inside a file:\n\n**`./aes.py --keyfile test.key --decrypt -in test.enc -out test`**\n\n**test.key**:\n```\nSixteen byte key\n```\n\nYou can specify the operation mode used for cipher multiple blocks.\n\n**`./aes.py --keyfile test.key --decrypt -in test.enc -out test -m \"ECB\"`**\n\nDefaults to **CBC**.\n","funding_links":["https://ko-fi.com/carleslc"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarleslc%2Fcrypttools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarleslc%2Fcrypttools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarleslc%2Fcrypttools/lists"}