This is a draft cheat sheet. It is a work in progress and is not finished yet.
General information
Cryptology a science for encryption and decryption, so therefore also for informationsecurity
|
Cryptography encryption of information / security for the own secret communication
|
Cryptanalytics get information out of encrypted information / breach of the security
|
Encryption (Chiffrierung) clear text gets converted into a hard to interpret character string
|
Decryption (Dechiffrierung) unknown char strings get converted into readable signs
|
EXAMPLE: String to morse code in Python
def translate_text(self, text):
if text == "":
return "You must provide a morse code string to translate"
translation = ""
words = text.split(" ")
for word in words:
w = list()
for char in word:
if char.lower() in self.morse:
w.append(self.morse[char.lower()])
translation += " ".join(w)
translation += " "
return translation.rstrip()
|
Morse code has to be defined in a dictionary!
output: ... . -.-. ..- .-. .. - -.--
|
|
Gartenzaunverfahren PYTHON
from functools import partial
def crypt(message, key, encrypt=True):
if key < 2:
raise ValueError('key must be >= 2')
message += ' ' * (-len(message) % key)
step = key if encrypt else len(message) // key
return ''.join(message[i::step] for i in xrange(step)).rstrip()
encrypt = crypt
decrypt = partial(crypt, encrypt=False)
def main():
message = 'Das ist eine lange Zeichenkette.'
for i in xrange(2, 10):
crypted = encrypt(message, i)
print '%d) %-38r %-38r' % (i, crypted, decrypt(crypted, i))
|
|