예제 #1
0
from crpt import Cryptography
import getwords

poem = 'Rgx hppeq hx fij gpiaij x Vpq cn jizij qppg qjob mxe Zx jifijmnobijcfq nqphkijc upi nqphkx Nqijcg upi nqxg iji ijce upi xe Fjjmappin zijq fij zijqqijm Fijzij x pgn c kgsn d Hppm cn bijq is ijiji gijqqijm Jt zxi bijq ijm qjob qvijij'

crypt = Cryptography()
crypt.set_encoded_text(poem)
keys = ['a', 'roerei', 'geklutst ei', 'omelet', 'gemakkelijk', 'makkelijk', 'simpel', 'eenvoudig', 'eitje', 'ijtje']
for key in keys:
  print(crypt.decode_vigenere(key))
  print(crypt.decode_monoalphabetic(key))
  print()

frequencies = {}
for i in range(26):
  char = chr(i+ord('a'))
  frequencies[char] = poem.lower().count(char)
print(frequencies)
# Given the letter frequencies, it feels like it needs to be/can monoalphabetic. However, I cannot find all the words' signatures in the dictionary...

enc_dec = {'F': 'v', 'J': 'o', 'M': 'r', 'A': 'b', 'P': 'e', 'I': 'l'}
string = poem.upper()
for enc, dec in enc_dec.items():
  string = string.replace(enc, dec)
print(string)

### Let's try merging the I and J, since that might be the hint
poem = poem.replace('ij', 'y')
frequencies = {}
for i in range(26):
  char = chr(i+ord('a'))
예제 #2
0
from crpt import Cryptography

strings = [
    'cdqiajneqgvajnkndwddqn', 'azczdfpjqcjndcscydcqfpjncd',
    'cksioupcirkhhlpdnigglhrild',
    'fmkcmtsfhgqpskkmqvcvcmgmnhgnsinchgnmomddscehdn', 'qmorlqditapofmqhcdah'
]
keys = [
    'Armando', 'Charles Aznavour', 'Koos Alberts', 'Montserrat Caballé',
    'Queen of Soul'
]

crypt = Cryptography()
for string, key in zip(strings, keys):
    crypt.set_encoded_text(string)
    print(key, crypt.decode_monoalphabetic(key))
예제 #3
0
# Get a frequency analysis of two-character groups
three_chars = []
for i in range(2, len(signs)):
    three_chars.append(signs[i - 2] + signs[i - 1] + signs[i])
#print({key: len(list(group)) for key, group in groupby(sorted(three_chars))})

# Print the number series
strng = ''
for x in signs:
    strng = strng + str(int(x, 2)) + ' '
print(strng)

# Decode it with Baudot
full_string = ''.join(signs)
crypt = Cryptography()
crypt.set_encoded_text(full_string)
print(crypt.decode_baudot())

signs = [
    '01001', '11100', '00100', '10010', '11100', '10000', '11110', '01011',
    '01010', '11100', '01011', '00010', '10000', '00110', '11100', '00010',
    '00111', '10111', '00001', '11101', '01010', '10000', '01100', '00001',
    '11101', '11100', '00010', '11101', '11100', '00100', '11100', '00001',
    '10000', '11110', '10000', '00111', '10000', '11100', '00001', '10000',
    '11111'
]

# Decode it with Baudot
full_string = ''.join(signs)
crypt = Cryptography()
예제 #4
0
words = [
    'GEESTELIJK', 'ONGEWIJD', 'MACHTIG', 'WEERGEKOMEN', 'STER', 'WERKELIJK',
    'KINDJE', 'BUITEN', 'KNUFFELEN', 'KONIJN', 'LICHTBUNDEL', 'ENGELTJE',
    'KUNSTIG', 'PLASTISCH', 'HAASTEN', 'WINDSNELHEID', 'WEERLEGGEN', 'DUVEL',
    'ACHTER', 'FORMALISEREN', 'VLOEIEND', 'KOSTELIJK', 'STAPPEN', 'LUISTER',
    'REKENING', 'DONDER', 'STAGE', 'VERDER', 'FINEREN', 'FIER', 'ONBEGREPEN',
    'AANDACHTIG', 'ZINDELIJK', 'RESTJE', 'RECEPTIE', 'WOORDELIJKE', 'ONTERING',
    'LALA', 'OTTER', 'WERF', 'BRUI', 'EMMERS', 'MISERES', 'GETTO'
]

string = ''
for word in words:
    string += word[0]

crypt = Cryptography()
crypt.set_encoded_text(string)

for i in range(26):
    print(i, crypt.decode_rotation(i))

string = ''.join(words)
print(len(string))
for i in range(1, 50):
    prnt = ''
    for j in range(0, len(string), i):
        prnt += string[j]
    print(prnt)

# Solution
for word in words:
예제 #5
0
from crpt import Cryptography

crypt = Cryptography()
crypt.set_encoded_text(
    'emokrytrtjnidntgvqumvdasxxrjkfuhranjnhrcrgdnofrwnsdynffwlpwsykxxoorqzeuwyy'
)
#keys = ['rob bertholee', 'tot ziens', 'auf wiedersehen', 'au revoir', 'eunice gayson', 'dj hardwell', 'oudejaarsconference', 'oudjaarsconference', 'eindejaarsconference', 'eindjaarsconference', 'toptweeduizend', 'tweeduizendachtien', 'eurovisiesongfestival', 'elfstedentocht', 'elfstedenzwemtocht', 'eerste wereldoorlog', 'early man', 'escobar', 'Last Goodbye', 'No Good In Goodbye', 'Goodbye Stranger', 'Beautiful Goodbye', 'Goodbye My Lover', 'Time To Say Goodbye Con Te Partirò', 'Sweet Goodbyes', 'een afscheid', 'een afscheid met een ingebouwde terugblik', 'emeritaat', 'saluut', 'afzwaai', 'vertrek', 'groeten', 'ontslag', 'bedankje', 'adieu', 'ajuus', 'scheiding', 'uitgeleide', 'echtscheiding', 'vertrek', 'flashback', 'beschouwing', 'retrospectie', 'reflectie', 'edwin evers', 'evers staat op', 'Geniet van alles gun elkaar wat en wat mij betreft graag tot snel', 'een restart met een kleine tussenpauze', 'weet je het zeker', 'vreemde wegen', 'Het ware prachtige bijzondere indrukwekkende en vaak ook vreemde wegen die mij brachten tot hier', 'herdenkinksbijeenkomst wim kok', 'marathonuitzending', 'afscheid edwin evers', 'We gaan er gewoon een leuke dag van maken We gaan een klein beetje terugblikken en niet te sentimenteel doen', 'We gaan een klein beetje terugblikken en niet te sentimenteel doen', 'afscheidsuitzending', 'afscheidsuitzending edwin evers']
keys = []

#print(crypt.decode_atbash())
#for i in range(2,10):
#  print(crypt.decode_rail_fence(i))
for key in keys:
    print(crypt.decode_bifid(key))
    print(crypt.decode_playfair(key))
    print(crypt.decode_vigenere(key))
#for key in keys:
#  print(crypt.decode_bifid(key[::-1]))
#  print(crypt.decode_playfair(key[::-1]))
#  print(crypt.decode_vigenere(key[::-1]))

plains = [
    'edwin evers', 'evers staat op',
    'Geniet van alles gun elkaar wat en wat mij betreft graag tot snel',
    'een restart met een kleine tussenpauze', 'weet je het zeker',
    'vreemde wegen',
    'Het ware prachtige bijzondere indrukwekkende en vaak ook vreemde wegen die mij brachten tot hier',
    'herdenkinksbijeenkomst wim kok', 'marathonuitzending',
    'afscheid edwin evers',
    'We gaan er gewoon een leuke dag van maken We gaan een klein beetje terugblikken en niet te sentimenteel doen',
    'We gaan een klein beetje terugblikken en niet te sentimenteel doen',
예제 #6
0
from crpt import Cryptography

signs = 'LB RO RB LB RO RB RO LB RB RO RO LB RB LB RB RO RO LB LB RB LB LB RB LB RB RO LB LO RO LB LB RB LB LO RO LB LB RB LB RB RO LB RB RO LB RO RB LB RO RO RB LB LB RB LB RO RO RO RB RO RO LB LB RB LB RB RO LB LO LB LB LB RO RB LB RO RB RO LB LO RO RO RB LB RB RO LB RB LB LB LB RB LB RB RO LB LO LB LB LB RO RB LB RB LB RO LB RB LB LB LB RB RO LB RO LB RB LB LB LB LB RB LB LB RB LB RO LB LB RB LB RO LB LB RB LB RB RO LB RB RO RO LB LB RO RO LO RO RO LB LB RB RO RO RO RB RO LB LB RB LB RO RB RO LB RB LB LB RB RO RO LB LO RO LB LB RB LB RO RB RO LO LB LB LB RB RO RO RO RB RO RO RB RO RO RB LB LB RB RO RO LB RB LB RB RO LB LO RO RO LB RB LB RB RO RO RB LB RO RB RO LB RO RB RO LB RO RB LB RB LB RO LB LB RB LB LB RB LB RO RO RO RB RO LB RO RB LB RB LB RO LB LO RO LB LB RB LB RO RB RO LB LO LB RO RB RO LB RB RO LB LB RB LB RB LB RO LB RB LB RB RO LB LO RO LB LB RB LB LO LB RB LB RB RO LB LO RO RO RO RB LB LB RO LB LO LB RO RB RO LB RB RO LB LB RB LB RB LB RO LB RB LB LO LB LB LB RO RB RO RO RO RB LB RO LB RB RO RO LO LB LB LB RO RB LB RO RB RO LB LO RO RO LB RB LB RB LB RO LB LB RB RO RO RO RB RO RO RO RB LB LB RO LB LO RO RO RO RB RO RO RB LB RO RB LB RO LB RB RO RO RB LB RB RO LB RB RO RO LB LB RO RO LO LB RO RO RB LB RO RB RO LB RB RO LO LB RO RO RB LB RO RB RO LO RO LB LB RB LB LO LB RB LB RB RO LB LO LB RO LB LB RB LB RB LB LB RB RO LB LB RB RO LO RO RB RO RO RO RB RO LO RO RO LB RB LB RB RO LB LB LB RB LB RB RO LB LB LO RO LB RO RB LB RO RB RO LB LO RO LB LB RB LB LO LB RO RB RO LB RB RO LB LB RB LB RB LB RO LB LO RO RB RO RO RO RB RO LO LB LB LB RB LB RO RO LB RB RO RO RO RB RO RB RO RB LB RB LB RO LB RB RO LB RB LB LB RB LB RO RO RO LO LB RO LB LB RB LB RB LB LB RB RO LB LB RB LB RB RO LB RB RO RO LB LB RO RO LO RO LB RO LB RB RO RO RO RB RO LB RB RO LB RO LB RB LB RO LB LB RB LB LB RO RB RO LB LB RB LB RB LB RB LB RO LB LO LB LB RB RO LB RO RB RO RO LB LB RO RO LO RO LB LB RB LB RO RB RO LO LB LB RB LB RB RO LB LB RB LB RB LB RO LB RB LB RB LB RB RO LB LO LB LB LB RO RB LB RO LB RB LB LB RB LB RO RO RO LO RO RO LB LB RB RO RO RO RB LB LB RO LO RO RO RB RO RO RO RB LB RB RO RB LB RB RO LB LO RO RO LB LB RB LB LB RB LB RO RO RO RB RO LB LO RO RO RO RB RO RO LO LB LB LB RO RB RO RO RO RB RO RO RO RB LB RO LB LO RO RO LB LB RB LB LB RB RO LB RO LB RB LB LB LB LB RB RO RO LB LB RB LB RB LB RO LB LB RB LB LB RO LB LO RO LB LB RB LB LO RO LB LB LB RB LB RO RB LB LB LB RB LB LB RB LB LB LB LO LB LB LB RO RB LB RO RB RO LB LO RO RO LB LB RB LB LB RB LB RO RO RO RB RO LB LO RO RO RO RB LB LB LB RO RB LB RB LB RO LB RB RO RB LB LB RO RB LB LB RB RO RO LB RB LB LB RB RO LB RB RO RO LB LO RO RB LB LO RO LB RO RB LB LB RB LB RB RO RO LB LB RB LB RB RO LB RB RO RO LB LB RO RO LO LB RB RO LB LO RO LB LB RB LB RO RB RO LO RO RO LB RB LB RB LB RO LB LB RB RO RO RO RB RO RO RO RB LB LB RO LB LO LB RO RB LB RO LB LB RB LB RO LB LB RB LB RB LB RB RO LB LO RO RO LB LB RB RO RO RO RB LB LB RO LO RO RO RB RO RO RO RB LB RB RO RB LB RB RO LB LO LB RO RO RB RO RO RO RB LB RO LB RB RO LB LB RB LB RB RO LB LO RO LB LB LB RB LB RB RO RO RO RB RO RO RO RB LB RO LB RB RO LB LB RB LB RB LB RB LB RO LB LB RB RO LB LB LO RO RO RO RB LB RO RO LB LO RO LB LB RB LB LO LB LB LB RO RB LB RO LB RB LB LB RO RB RO LB RO LB RB LB LB LB LB RB RO RB LB RB RO LB LO RO LB LB RB LB LB RB LB LO LB LB LB LB RB LB RB RO LO LB LB LB RO RB RO RO RO RB RO RO RO RB LB RO LB RB RO RB RO LB LB LB RB LB RO LB RB LB RB RO LB RB RO RO LB RB RO RB LB RO LB RO LB RO LO LB LB LB LB RB LB RB RO LO LB LB LB RO RB RO RO RO RB RO RO RO RB LB RO LB RB RO RB RO LB LB LB RB LB RO LB RB LB RB RO LB RB RO RO LB RB RO RB LB RO LB RO LB RO'

# Apply the morse signs
signs = signs.replace(' ', '')
signs = signs.replace('LB', '.')
signs = signs.replace('LO', ' ')
signs = signs.replace('RB', ' ')
signs = signs.replace('RO', '-')

# Decode morse letter by morse letter
crypt = Cryptography()
letters = signs.split(' ')
string = ''
for letter in letters:
  crypt.set_encoded_text(letter)
  decoded = crypt.decode_morse()
  if not decoded is None:
    string = string + crypt.decode_morse()

print(string)
예제 #7
0
    'Paul Snoek': 3,
    'Cas Spijkers': 2,
    'Helene Swarth': 5,
    'Jan Terlouw': 1,
    'Mario Uva': 2,
    'Maxime Verhagen': 1,
    'Albert Verwey': 5,
    'Simon Vinkenoog': 3,
    'Hans Wiegel': 1,
    'Johan de Witt': 4,
    'Johan Witteveen': 1,
    'Hans van Wolde': 2,
    'Gerrit Zalm': 1
}

crypt = Cryptography()

# Encode all names by their category
for person, group in people.items():
    if group in categories:
        key = categories[group]
        crypt.set_decoded_text(person)
        print(person, crypt.encode_bifid(key))

# Determine to which group the remaining encoded name belongs
remainder = 'AEGILRHIEXL'
for group in categories:
    key = categories[group]
    crypt.set_encoded_text(remainder)
    print(key, crypt.decode_bifid(key))
    crypt.set_encoded_text(remainder[::-1])
예제 #8
0
           ['A', 'H', 'H', 'J', 'N', 'O', 'S', 'T', 'U', 'U', 'V', 'X', 'X'],
           ['A', 'E', 'F', 'F', 'G', 'L', 'O', 'O', 'P', 'T', 'V', 'W', 'W'],
           ['A', 'E', 'F', 'M', 'M', 'N', 'O', 'P', 'Q', 'T', 'X', 'X', 'Z'],
           ['C', 'D', 'E', 'I', 'I', 'L', 'L', 'R', 'T', 'V', 'X', 'X', 'X'],
           ['A', 'D', 'E', 'G', 'G', 'O', 'R', 'S', 'S', 'T', 'U', 'Y', 'Z'],
           ['A', 'E', 'E', 'H', 'L', 'Q', 'T', 'W', 'X', 'X', 'Y', 'Z', 'Z'],
           ['A', 'A', 'I', 'N', 'O', 'Q', 'R', 'R', 'R', 'S', 'V', 'X', 'X'],
           ['F', 'K', 'K', 'O', 'P', 'Q', 'R', 'T', 'T', 'V', 'W', 'W', 'Y'],
           ['B', 'C', 'E', 'E', 'F', 'I', 'I', 'R', 'T', 'T', 'U', 'V', 'X']]

options = []
i = 0
for column in columns:
    string = ''
    for letter in column:
        if letter in rows[12]:
            string = string + letter.lower()
    options.append(''.join(sorted(list(set(string)))))
    i += 1

print(options)

crypt = Cryptography()
crypt.set_decoded_text(
    'terdamse kraamzaal het kind Jacob Willem Katadreuffe met de sectio caesarea ter wereld geholpen'
    .lower().replace(' ', 'x'))
crypt.set_encoded_text(
    'AIKAGQRSZRKEXMMTWZLYHQFCFQHUWACAYSWVIOIJFXVTLOVRXJCHLOIGQAYFLBFXFFLOARPBZRTUOEEUZIQIIVZNVPXGTVKU'
)
print(crypt.get_vigenere_key())