Programme de chiffrement et déchiffrement affine d'un message en python3.

Overview

Chiffrement Affine En Python3

Programme de chiffrement et déchiffrement affine d'un message en python3.

Explication du chiffrement affine avec complexité O(n2)

  1. D’abord on donne une liste d’alphabet en minuscule et une liste d’alphabet en majuscule.

  2. On parcourt tout l’alphabet et on append l’alphabet en minuscule et l’alphabet en majuscule à chaque parcourt.

  3. On crée une fonction qui retourne le pgcd de deux nombres a et b, qui change la position de a et b à chaque parcourt et effectue le modulo de a et b.

  4. Ensuite on a une fonction de chiffrementAffine qui prend en paramètre a, b et L qui servira plus tard pour le chiffrement de notre message, au départ on testera si la lettre est une majuscule ou une minuscule après on cherchera l’indice de la lettre qu’on utilisera en appliquant la formule Y=(ax+b) mod 26 ou y est l’indice de la lettre chiffre sinon si la lettre n’est pas dans l’alphabet on (symbole) on la renverra.

  5. Après on a deux fonctions pour calculer l’inverse d’un nombre a, la 1ere n’a pas était vu en cours mais elle nécessite moins d’opérations que celle vu en cours et pour cela nous l’avons pris mais c ne change pas grande chose puisque la complexité reste la même pour les deux algorithmes. Pour le 1ere fonction elle prendra en paramètre a donnera son inverse modulaire 26 d’un nombre pour cela on initialise x à 0 et on utilise une boucle tant que a*x%26 n'est pas différent de 1, x prend la valeur de x + 1 et finit par retourner la valeur de x à la fin. Et pour la 2eme fonction d’Euclide on applique exactement la formule vue en cours pour l’algorithme d’Euclide étendu.

  6. Par la suite on a une fonction dechiffrementAfiine qui prend les mêmes paramètres de la fonction chiffrementAffine et qui fait la même chose que la fonction chiffrementAffine mais la seule différence est que y prend la valeur de (l’inverse de a)*(x-b) modulo 26. Au départ on testera si la lettre est une lettre majuscule ou minuscule après on récupéra l’indice de la lettre qu’on utilisera pour trouver l’indice de la lettre déchiffre en utilisant la formule évoque précédemment sinon si la lettre est un symbole on la renverra.

  7. On a deux fonctions l’une crypt et l’autre decrypt, l’une qui sert à crypter notre Jeux d’essais à l’aide de la fonction chiffrementAffine et l’autre sert à decrypter notre message, à l’aide de la fonction dechiffrementAffine ils vont toute les deux appeler les fonctions chiffrementAffine et dechiffrementAffine n fois avec n égale à la taille du message.

  8. Finalement on affiche les messages chiffrés et les messages déchiffrés.

Execution

python3 Chiffrement_Affine.py

Owner
Malik Makkes
Malik Makkes
A workshop to build an NFT smart contract on the polygon blockchain

Polygon NFT Workshop This is an interactive workshop that guides you through the steps to deploy an NFT smart contract on the Polygon blockchain. By t

Banjo Obayomi 56 Oct 14, 2022
Get the SHA256 hash of any file with this Python Script

Hashfile-SHA256 A SHA256 hash verifying script, written in python. Report Bug Table of Contents About The Project Built With Getting Started Prerequis

Ethan Gallucci 1 Nov 01, 2021
Python Encryption Name Game

Python 3.9.7 Encryption Name Game Encrypt a name with numbers using a Caesar cipher! You can choose different numbers to encrypt your name from 1 to o

Armand Brunelle 3 Dec 24, 2021
A really, really bad way to encrypt your text

deoxyencryptingnucleicacids A really, really bad way to encrypt your text. A general description of the scheme Encoding: The ascii plaintext is first

Sam Pinkerton 1 Nov 01, 2021
RSI Algorithmic Trading with Python

In this repository you can see my first algorithhmic trading script. I use 5 cryptocurrencies: Bitcoin (BTC), Ethereum (ETH), Bitcoin Cash (BCH), Litecoin (LTC) and Chainlink (LINK).

Jon Aldekoa 4 Mar 16, 2022
A python script for AES Angecryption in Steganography

Angecryption is an encryption or an decryption result from a file to create an other file with the same / or not type.

ISIS 3 Jul 25, 2022
An encryption format offering better security, performance and ease of use than PGP.

An encryption format offering better security, performance and ease of use than PGP. File a bug if you found anything where we are worse than our competition, and we will fix it.

27 Dec 25, 2022
That Hash will name that hash type! Identify MD5, SHA256 and 300+ other hashes Comes with

Call for translators! We're looking for translators to help translate this spec for everyone! Read this documentation in the following languages 한국어 中

All Contributors 6.8k Jan 05, 2023
Random Pasword Generator Sezar Crypto

Random_Pasword_Generator_Sezar_Crypto Simple Work Main design available in ana_sayfa.ui / ana_sayfa2.py Popup design available in popup.ui / anahtarp

Ahmet Gündoğdu - DRAGO 2 Dec 19, 2021
EncryptAGit - Encrypt Your Git Repos

EncryptAGit - Encrypt Your Git Repos

midnite_runr 25 Oct 06, 2022
GreenDoge is a modern community-centric green cryptocurrency based on a proof-of-space-and-time consensus algorithm.

GreenDoge Blockchain Download GreenDoge blockchain GreenDoge is a modern community-centric green cryptocurrency based on a proof-of-space-and-time con

40 Sep 11, 2022
Simple python program to encrypt files with AES-256 encryption

simple-enc Simple python program to encrypt files with AES-256 encryption Setup First install "pyAesCrypt" using pip. Thats it! Optionally you can add

Hashm 2 Jan 19, 2022
Stenography encryption script

ImageCrypt Project description Installation Usage Project description Project AlexGyver on Python by TheK4n Design by Пашушка Byte packing in decimal

Kan 5 Dec 14, 2022
G-Research-Crypto-Competition - Project for passing the ML exam. Dataset took from the competition on the kaggle

G-Research-Crypto-Competition Project for passing the ML exam. Dataset took from

5 Jan 09, 2022
Coins farmer for dank memer

Created by TheRider#5308 [feel free to drop by to talk]. Note to some Dank Memer staff reading this: Nah I don't self bot, already got banned for that

Siddhant Kumar 3 Nov 10, 2021
Gearbox-vyper-contracts - Auxillary contracts for the Gearbox Protocol written in Vyper

Gearbox Vyper Contracts Auxillary contracts for the Gearbox Protocol written in

Edward Amor 4 Jan 07, 2022
The (Python-based) mining software required for the Nintendo Switch mining project.

ntgbtminer - Nintendo Switch edition This is a version of ntgbtminer that works with the Nintendo Switch bitcoin miner. ntgbtminer ntgbtminer is a no

4 Jun 03, 2021
This is a simple application to generate HD wallet addresses for cryptocurrency coins.

HD-Wallet-Address This is a mini service to generate addresses in the master HD-Wallet. It will use py_crypto_hd_wallet package as a base. Prerequisit

Amin Abbasi 1 Dec 16, 2021
Bombcrypto-robot - Python bot to automate BombCrypto game. Updated 01.02.2022

About: This is an open-source bot, the code is open for anyone to see, fork and

LarkoPa 120 Apr 15, 2022
Privfiles - Encrypted file storage using Fernet with zero Javascript

Privfiles - Encrypted file storage using Fernet with zero Javascript Source code for the onion service: l3n6v6dm63frml22tlmzacnasvp7co7wylu4hhcs34ukxe

Ward 5 Jul 30, 2022