Show Menu
Cheatography

Kryptologie Cheat Sheet (DRAFT) by

Kryptologie Cheasheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

General inform­ation

Cryptology
a science for encryption and decryp­tion, so therefore also for inform­ati­ons­ecurity
Crypto­graphy
encryption of inform­ation / security for the own secret commun­ication
Crypta­nal­ytics
get inform­ation out of encrypted inform­ation / breach of the security
Encryption (Chiff­rie­rung)
clear text gets converted into a hard to interpret character string
Decryption (Dechi­ffr­ierung)
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 dictio­nary!

output: ... . -.-. ..- .-. .. - -.--
 

Garten­zau­nve­rfahren 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))