https://github.com/daisvke/ciphers
A set of ciphers.
https://github.com/daisvke/ciphers
cipher cryptography encryption encryption-algorithms encryption-decryption security-tools xor-cipher
Last synced: about 2 months ago
JSON representation
A set of ciphers.
- Host: GitHub
- URL: https://github.com/daisvke/ciphers
- Owner: daisvke
- Created: 2023-07-07T14:43:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-21T22:27:16.000Z (2 months ago)
- Last Synced: 2025-02-21T23:42:56.343Z (2 months ago)
- Topics: cipher, cryptography, encryption, encryption-algorithms, encryption-decryption, security-tools, xor-cipher
- Language: Python
- Homepage:
- Size: 688 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Ciphers**
A set of ciphers.## **XOR Cipher**
```c
void xor_encrypt_decrypt(void *key, size_t key_length, void *data, size_t data_length)
```
An XOR cipher in assembly language.
In cryptography, the simple XOR cipher is a type of additive cipher, an encryption algorithm that operates in binary according to the following principle:```
0 1 1
0 1 0
_____
=> 0 0 1
```Encryption and decryption are done using the same algorithm.
## **XOR with Addition**
```c
void xor_with_additive_cipher(
void *key, size_t key_length, void *data, size_t data_length)
```
We’ve added an additive cipher to the previous XOR cipher:
```
- Encryption:
1. +
2. XOR- Decryption:
1. XOR
2. -
```## **Alphadigit**
### **Description**
A numbered alphabet cipher written in Python.
- 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.
- The reverse process is done during decryption.
- It can only decode numbers separated by spaces.
- Handled alphabetical characters include:
- `a-z`, `Ç-Ü`, `á-Ñ`.
- It also handles punctuation.
- 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.
- For instance, if we left the digits in the final output:
- When encoding:
`1cm` => *encode* => `1 3 13`
- When decoding:
`1 3 13` => *decode* => `ACM` != `1cm`---
### **Commands**
```bash
# Usage
./alphadigit [option] [source],...# option
-s: Use spaces between numbers in encryption mode’s output string.
-v: Verbose mode. Useful to disable when reusing the output through pipes, etc.
```
---
### **Screenshot**(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).)
## **HexToBase32**
### **Description**
A C++ function to convert a hexadecimal string to a Base32 string.## **Morse Encoder**
### **Description**
A python Class to convert a string into Morse code, and vice versa, handling space and alphanumeric characters with a dictionary lookup.### **Commands**
```bash
# Usage
morse_encoder.py [-h] [-r] string# positional arguments:
string the text to convert# options:
-h, --help show this help message and exit
-r, --reverse convert from Morse code to alphanumerical string# Example:
./morse_encoder.py "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOGS BACK 1234567890"
```
---
### **Screenshot**## **Alphabet**
### **Description**
A simple substitution cipher that encodes texts according to a custom alphabet declared in `alphabet.json`.
- The program takes a string as an argument and encodes or decodes it according to our **custom alphabet**.
- By default, the custom alphabet supports **alphanumeric characters**, but you can add any character set you like.
- All unhandled characters will remain **unencoded** in the final output.
* Default alphabet:
```
'A': 'X',
'B': '8',
'C': 'Q',
'D': 'j',
'E': 'à',
'F': 'y',
'G': '^',
'H': 'ù',
'I': 's',
'J': '$',
'K': 'x',
'L': 'N',
'M': 'S',
...
```
---
### **Commands**
```bash
# Usage
alphabet.py [-h] [-r] string_to_convert alphabet_dict# positional arguments:
string_to_convert the text to convert
alphabet_dict JSON file containing the custom alphabet# options:
-h, --help show this help message and exit
-r, --reverse convert an encoded text to the original text
```
---
### Screenshot
![]()