Encrypt and Decrypt data with famous cryptography techniques
Project description
KRYPTOR
CAESAR CIPHER
In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.
The transformation can be represented by aligning two alphabets; the cipher alphabet is the plain alphabet rotated left or right by some number of positions. For instance, here is a Caesar cipher using a left rotation of three places, equivalent to a right shift of 23 (the shift parameter is used as the key):
Plain | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Cipher | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W |
Plaintext: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD
PLAYFAIR CIPHER
The Playfair cipher or Playfair square or Wheatstone–Playfair cipher is a manual symmetric encryption technique and was the first literal digram substitution cipher. The scheme was invented in 1854 by Charles Wheatstone, but bears the name of Lord Playfair for promoting its use.
The technique encrypts pairs of letters (bigrams or digrams), instead of single letters as in the simple substitution cipher and rather more complex Vigenère cipher systems than in use. The Playfair is thus significantly harder to break since the frequency analysis used for simple substitution ciphers does not work with it. The frequency analysis of bigrams is possible, but considerably more difficult. With 600 possible bigrams rather than the 26 possible monograms (single symbols, usually letters in this context), a considerably larger cipher text is required in order to be useful.
Using "playfair example" as the key (assuming that I and J are interchangeable), the table becomes (omitted letters in red):
The first step of encrypting the message "hide the gold in the tree stump" is to convert it to the pairs of letters "HI DE TH EG OL DI NT HE TR EX ES TU MP" (with the null "X" used to separate the repeated "E"s). Then:
- The pair HI forms a rectangle, replace it with BM
- The pair DE is in a column, replace it with OD
- The pair TH forms a rectangle, replace it with ZB
- The pair EG forms a rectangle, replace it with XD
- The pair OL forms a rectangle, replace it with NA
- The pair DI forms a rectangle, replace it with BE
- The pair NT forms a rectangle, replace it with KU
- The pair HE forms a rectangle, replace it with DM
- The pair TR forms a rectangle, replace it with UI
- The pair EX (X inserted to split EE) is in a row, replace it with XM
- The pair ES forms a rectangle, replace it with MO
- The pair TU is in a row, replace it with UV
- The pair MP forms a rectangle, replace it with IF
Thus, the message "hide the gold in the tree stump" becomes "BM OD ZB XD NA BE KU DM UI XM MO UV IF", which may be restructured as "BMODZ BXDNA BEKUD MUIXM MOUVI F" for ease of reading the cipher text.
MORSE CODE
Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes, or dits and dahs. Morse code is named after Samuel Morse, one of the inventors of the telegraph.
A = .-
B = -...
C = -.-.
D = -..
E = .
F = ..-.
G = --.
H = ....
I = ..
J = .---
K = -.-
L = .-..
M = --
N = -.
O = ---
P = .--.
Q = --.-
R = .-.
S = ...
T = -
U = ..-
V = ...-
W = .--
X = -..-
Y = -.--
Z = --..
1 = .----
2 = ..---
3 = ...--
4 = ....-
5 = .....
6 = -....
7 = --...
8 = ---..
9 = ----.
0 = -----
, = --..--
. = .-.-.-
? = ..--..
/ = -..-.
- = -....-
( = -.--.
) = -.--.-
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kryptor-0.1.0.tar.gz
.
File metadata
- Download URL: kryptor-0.1.0.tar.gz
- Upload date:
- Size: 43.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 778f8527e95d7fc6cb48dda35154065249550c25f7d5a7666aebaf5215e56437 |
|
MD5 | 20d5c96a1e7b9316dc8ca1f8feceeeee |
|
BLAKE2b-256 | 895b5a10b54e122e4258e9dbe38e0b6ddb2bd7c9f6607137d2c57b7e16bd7d72 |
File details
Details for the file kryptor-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: kryptor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abf81da34561d91391cb86f4ddcda927a8bbb3b8ca0a7e0b9dd9c5d1aa5b1e0b |
|
MD5 | e9ac796ef7b5bd36cf81d0af84c20835 |
|
BLAKE2b-256 | a9434f46216126aeae20e4f93032da19faf0cf09a7523a9730fdc100258c5543 |