{"id":25812583,"url":"https://github.com/daisvke/ciphers","last_synced_at":"2025-08-14T07:47:03.375Z","repository":{"id":179470730,"uuid":"663545662","full_name":"daisvke/ciphers","owner":"daisvke","description":"A set of ciphers.","archived":false,"fork":false,"pushed_at":"2025-03-21T21:38:12.000Z","size":706,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T22:27:10.624Z","etag":null,"topics":["cipher","cryptography","encryption","encryption-algorithms","encryption-decryption","security-tools","xor-cipher"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daisvke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-07-07T14:43:58.000Z","updated_at":"2025-03-21T21:38:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"c070257c-4d63-444f-9858-688472074622","html_url":"https://github.com/daisvke/ciphers","commit_stats":null,"previous_names":["daisvke/ciphers"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daisvke/ciphers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daisvke%2Fciphers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daisvke%2Fciphers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daisvke%2Fciphers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daisvke%2Fciphers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daisvke","download_url":"https://codeload.github.com/daisvke/ciphers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daisvke%2Fciphers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270385320,"owners_count":24574544,"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-14T02:00:10.309Z","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":["cipher","cryptography","encryption","encryption-algorithms","encryption-decryption","security-tools","xor-cipher"],"created_at":"2025-02-28T01:54:34.262Z","updated_at":"2025-08-14T07:47:03.355Z","avatar_url":"https://github.com/daisvke.png","language":"Python","readme":"# **Ciphers**\nA set of ciphers.\n\n## **XOR Cipher**\n```c\nvoid xor_encrypt_decrypt(void *key, size_t key_length, void *data, size_t data_length)\n                             \u003crdi\u003e           \u003crsi\u003e        \u003crdx\u003e            \u003crcx\u003e\n```\nAn XOR cipher in assembly language.  \nIn cryptography, the simple XOR cipher is a type of additive cipher, an encryption algorithm that operates in binary according to the following principle:\n\n```\n   0 1 1\n   0 1 0\n   _____\n=\u003e 0 0 1\n```\n\nEncryption and decryption are done using the same algorithm.\n\n\n## **XOR with Addition**\n```c\nvoid xor_with_additive_cipher(\n    void *key, size_t key_length, void *data, size_t data_length)\n         \u003crdi\u003e           \u003crsi\u003e         \u003crdx\u003e           \u003crcx\u003e\n```\nWe’ve added an additive cipher to the previous XOR cipher:\n```\n- Encryption:\n    1. \u003cbyte\u003e + \u003cadditive cipher value\u003e\n    2. XOR \u003cdata-byte\u003e \u003ckey-byte\u003e\n\n- Decryption:\n    1. XOR \u003cdata-byte\u003e \u003ckey-byte\u003e\n    2. \u003cbyte\u003e - \u003cadditive cipher value\u003e\n```\n\n## **Alphadigit**\n\n### **Description**\nA numbered alphabet cipher written in Python.  \n- During encryption, it takes command-line arguments, converts each argument to a series of numbers representing the position of each character in the alphabet, and prints the results.  \n- The reverse process is done during decryption.\n- It can only decode numbers separated by spaces.\n- Handled alphabetical characters include:  \n- `a-z`, `Ç-Ü`, `á-Ñ`.  \n- It also handles punctuation.\n- Arguments can only contain either all digits or all letters, but not both. This is to avoid any confusion, as we have a numerical cipher.\u003cbr /\u003e\n  - For instance, if we left the digits in the final output:\n    - When encoding:\u003cbr /\u003e\n    `1cm` =\u003e *encode* =\u003e `1 3 13`\n    - When decoding:\u003cbr /\u003e\n    `1 3 13` =\u003e *decode* =\u003e `ACM` != `1cm`\n\n---\n### **Commands**\n```bash\n# Usage\n./alphadigit [option] [source],...\n\n# option\n-s: Use spaces between numbers in encryption mode’s output string.\n-v: Verbose mode. Useful to disable when reusing the output through pipes, etc.\n```\n---\n### **Screenshot**\n\u003cimg src=\"screenshots/alphadigit.png\" /\u003e\n\n(The inaugural message transmitted over the Moscow–Washington hotline on August 30, 1963, was the test phrase: `THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG'S BACK 1234567890`, which is a [pangram](https://en.wikipedia.org/wiki/Pangram).)\n\n\n## **HexToBase32**\n\n### **Description**\nA C++ function to convert a hexadecimal string to a Base32 string.\n\n\n## **Morse Encoder**\n\n### **Description**\nA python Class to convert a string into Morse code, and vice versa, handling space and alphanumeric characters with a dictionary lookup.\n\n### **Commands**\n```bash\n# Usage\nmorse_encoder.py [-h] [-r] string\n\n# positional arguments:\n  string         the text to convert\n\n# options:\n  -h, --help     show this help message and exit\n  -r, --reverse  convert from Morse code to alphanumerical string\n\n# Example:\n./morse_encoder.py \"THE QUICK BROWN FOX JUMPED OVER THE LAZY DOGS BACK 1234567890\"\n```\n---\n### **Screenshot**\n\u003cimg src=\"screenshots/morse.png\" /\u003e\n\n\n## **Alphabet**\n\n### **Description**\n\nA simple substitution cipher that encodes texts according to a custom alphabet declared in `alphabet.json`.\n\n- The program takes a string as an argument and encodes or decodes it according to our **custom alphabet**.\n\n- By default, the custom alphabet supports **alphanumeric characters**, but you can add any character set you like.\n\n- All unhandled characters will remain **unencoded** in the final output.\n\n* Default alphabet:\n```\n    'A': 'X',\n    'B': '8',\n    'C': 'Q',\n    'D': 'j',\n    'E': 'à',\n    'F': 'y',\n    'G': '^',\n    'H': 'ù',\n    'I': 's',\n    'J': '$',\n    'K': 'x',\n    'L': 'N',\n    'M': 'S',\n    ...\n```\n---\n### **Commands**\n```bash\n# Usage\nalphabet.py [-h] [-r] string_to_convert alphabet_dict\n\n# positional arguments:\n  string_to_convert  the text to convert\n  alphabet_dict      JSON file containing the custom alphabet\n\n# options:\n  -h, --help     show this help message and exit\n  -r, --reverse  convert an encoded text to the original text\n```\n---\n### Screenshot\n\n\u003cimg src=\"screenshots/alphabet.png\" /\u003e\n\n## Keygens\n\n### **Description**\nThis folder contains key generators.\n\n### **`time_based_rand_keygen.c`**\n- Generates an encryption key randomly with two different functions\n\tusing different precision of the current time as seed.\n\n - charset: a set of characters that can be used for the key\n - strength: the width of the key\n\n- Setting the seed for the random number generator used by rand()\n\thelps ensuring that the sequence of random numbers generated by rand()\n\tis different each time the program runs.\n\n- The seed is set according to the current time, which makes it unique, but\n\tnot perfectly:\n\n\t- Using srand(time(NULL)) (like in the first function) seeds the random\n\t\tnumber generator with the current time in seconds.\n\t- This means that if you call srand(time(NULL)) multiple times within\n   \tthe same second, you will get the same sequence of random numbers\n \tbecause the seed value does not change.\n - Using clock_gettime(): This function (used in the second function) can\n\t\tprovide nanosecond precision, depending on the clock used. This will\n \timprove the randomness of the key.\n\n### **`random_keygen.c`**\n\nUsing /dev/urandom or /dev/random is generally more secure and\n\tprovides better randomness than using rand() with a time-based seed.\n\n#### Advantages of Using /dev/xrandom:\n\n\t- Cryptographic Security: /dev/xrandom is designed to provide\n\t\tcryptographically secure random numbers. It uses environmental\n\t\tnoise collected from device drivers and other sources to generate\n \trandom numbers, making it much harder to predict the output.\n\n\t- Non-Deterministic: Unlike rand(), which is a pseudo-random number\n \tgenerator (PRNG) that produces a deterministic sequence based on\n \tan initial seed, /dev/xrandom generates non-deterministic random\n \tnumbers. This means that even if you read from it multiple times\n \tin quick succession, you will get different values.\n\n\t- Higher Entropy: The randomness quality (entropy) of numbers generated\n \tfrom /dev/xrandom is significantly higher than that of rand().\n   This makes it suitable for applications that require high-quality\n \trandomness, such as cryptographic keys, secure tokens, and other\n \tsecurity-sensitive operations.\n\n\n#### /dev/urandom or /dev/random:\n\n- Blocking Behavior: /dev/random is a blocking source of random numbers.\nThis means that if there is not enough entropy (randomness) available\n\tin the system, reading from /dev/random will block (i.e., wait) until\n\tsufficient entropy is gathered.\nThis can lead to delays in applications that require random numbers.\n\n- While it may not provide the same level of entropy as /dev/random,\n\t/dev/urandom is generally considered secure enough for most applications,\n\tincluding cryptographic purposes. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaisvke%2Fciphers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaisvke%2Fciphers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaisvke%2Fciphers/lists"}