The skip cipher is a transposition cipher that consists of extracting the letters of a message every n characters (by jumping n characters or skipping n−1). When the end of the message is reached, resume at the beginning (loop).
for i in range(1, len(text)):
start = (start + step) % len(text)
cipher = cipher + text[start]The Encryption and Decryption logic are same in the case of Skip Code.
In cryptography, a scytale is a tool used to perform a transposition cipher, consisting of a cylinder with a strip of parchment wound around it on which is written a message. The ancient Greeks, and the Spartans in particular, are said to have used this cipher to communicate during military campaigns.
cypher = ''
text = split(text)
output = np.array(text)
output.resize(size, size)
for i in range(0, size):
for j in range(0, size):
if output[i][j] == '':
output[i][j] = '@'
output = output.transpose()
output = output.flatten()
for letter in output:
cypher += letterImplementing a Scytale using a 2 dimensional array.
Rail Fence Encryption uses an integer for the number of levels of the zigzag.The encoded message is written in zig-zag (like a rail fence/sawtooth) along a path with N levels/floors.
if len(text) % 2 != 0:
text += '@'
for letter in range(0, len(text)):
if letter % 2 == 0:
part1 += text[letter]
else:
part2 += text[letter]
text = part1 + part2"@" is used as a filler value in this method.
The Vigenère cipher is a method of encrypting alphabetic text by using a series of interwoven Caesar.ciphers, based on the letters of a keyword. It employs a form of polyalphabetic substitution. A polyalphabetic cipher is any cipher based on substitution, using multiple substitution alphabets . The encryption of the original text is done using the Vigenère square or Vigenère table.
for i in range(len(string)):
x = (ord(string[i]) +
ord(key[i])) % 26
x += ord('A')
cipher_text.append(chr(x))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.
keys = [x.upper() for x in keys]
for l in text:
for i in range(0, 26):
if l == letters[i]:
cipher += keys[i]
if l == ' ':
cipher += ' '