Exemple #1
0
def openfn():
    global current_image_filename
    global cipher
    filename = filedialog.askopenfilename(title='Upload')
    current_image_filename = filename
    cipher = Cipher(in_url=current_image_filename)
    return filename
Exemple #2
0
    def encrypt_caesar():
        global cipher
        cipher.encode_caesar(int(shift.get("1.0", END)))

        global current_image_filename
        temp = os.path.basename(current_image_filename)

        current_image_filename = os.getcwd() + "\\Encoded_Images\\" + temp
        cipher = Cipher(in_url=current_image_filename)
        show_img(cipher.in_url)
Exemple #3
0
    def encrypt_vigenere():
        global cipher
        cipher.encode_vigenere(keyword.get("1.0", END))

        global current_image_filename
        temp = os.path.basename(current_image_filename)

        current_image_filename = os.getcwd() + "\\Encoded_Images\\" + temp
        cipher = Cipher(in_url=current_image_filename)
        show_img(cipher.in_url)
Exemple #4
0
    def encrypt_multiplicative():
        global cipher
        cipher.encode_multiplicative(int(xShift.get("1.0", END)),
                                     int(yShift.get("1.0", END)))

        global current_image_filename
        temp = os.path.basename(current_image_filename)

        current_image_filename = os.getcwd() + "\\Encoded_Images\\" + temp
        cipher = Cipher(in_url=current_image_filename)
        show_img(cipher.in_url)
Exemple #5
0
def main():
    file_path = r"C:\Users\Shawn Huesman\Downloads\Evariste_galois.jpg"
    # file_path = r"C:\Users\Shawn Huesman\Github\Crymage\Examples\Encoded_Images\multiencoded.jpg"
    mcipher = Cipher(in_url=file_path)
    Cipher.encode_caesar(mcipher, 500)
    # Initialise le message
    msg = ""
    # Boucle sur tous les charactères du chiffrement
    for l in cipher:
        # Vérifie si le charactère fait partie de l'alphabet
        if l.lower() in alph:
            # Détermine la position de la lettre originale
            index = (MAP[l.lower()] - key) % MOD
            # Ajoute la lettre
            msg += alph[index]
        else:
            # Ajoute le charactère
            msg += l
    # Retourne le message déchiffré
    return msg


CIPHER = Cipher()
alph = CIPHER.get_alph()
MAP = CIPHER.get_map()

cipher = CIPHER.caesar("Allo")

# Teste les clés de 0 à 25
for i in range(len(alph)):
    # Obtient le message selon la 'ie' clé
    msg = caesar_decoder(cipher, i, alph, MAP)
    if (CIPHER.caesar_bonne_cle(msg, "Allo")):
        break

print(msg, i)
Exemple #7
0
def main():
    # file_path = r"galois.jpg"
    file_path = r"Examples\Encoded_Images\galois.jpg"
    mcipher = Cipher(in_url=file_path)
    Cipher.decode_affine(mcipher, 667, 905, 500)