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
Pogramme de chiffrement et déchiffrement césar d'un message en python3.

Chiffrement Cesar En Python3 Pogramme de chiffrement et déchiffrement césar d'un message en python3. Explication du chiffrement César avec complexité

Malik Makkes 1 Mar 26, 2022
Given a string or a text file with plain text , returns his encryption using SHA256 method

Encryption using SHA256 Given a string or a .txt file with plain text. Returns his encryption using SHA256 method Requirements : pip install pyperclip

yuno 3 Jan 24, 2022
一个关于摩斯密码解密与加密的库 / A library about encoding and decoding Morse code.

Morsecoder By Lemonix 介绍 一个关于摩斯密码解密与加密的库

Heat Studio 10 Jun 28, 2022
Cryptocurrency with implementet Blockchain

Cryptocurrency with implementet Blockchain

Mario 1 Mar 24, 2022
This demo is an on-chain NFT auction using smart contracts on the Algorand blockchain.

Algorand Auction Demo This demo is an on-chain NFT auction using smart contracts on the Algorand blockchain. Usage The file auction/operations.py prov

1 Jan 27, 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
Enchpyter, is able to encrypt and decrypt words as you determine, of course, according to the alphabet.

Enchpyter Enchpyter is a program do encrypt and decrypt any word you want (just letters). You enter how many letters jumps and write the word, so, the

João Assalim 2 Oct 10, 2022
😈 Shining is a tool that enables engineers to remotely pull smart contract code in multi-file situations.

👑 Shining 😈 Shining is a tool that enables engineers to remotely pull smart contract code in multi-file situations. Shining is the name of one of my

xxxeyJ 15 Jun 17, 2022
Hide secret data within a digital image using good ol' terminal

pystego Hide secret data within a digital image using good ol' terminal Installation The recommended way for installing this package is using, python

Ayush Gupta 1 Jan 06, 2022
Dicoding Machine Learning for Expert Submission 1 - Predictive Analytics

Laporan Proyek Machine Learning - Azhar Rizki Zulma Domain Proyek Domain proyek yang dipilih dalam proyek machine learning ini adalah mengenai keuanga

Azhar Rizki Zulma 6 Jul 23, 2022
A simple and secure password-based encryption & decryption algorithm based on hash functions, implemented solely based on python.

pyhcrypt A simple and secure password-based encryption & decryption algorithm based on hash functions, implemented solely based on python. Usage Pytho

Hongfei Xu 3 Feb 08, 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
Blockchain Python Implementation

Blockchain Python Implementation

0918nobita 2 Nov 21, 2021
Venax 116 Dec 21, 2022
Bridge between L1 (Ethereum) and L2 (cheapETH)

The ETH chain and the cheapETH chain. We can assume the ETH chain has ~1000x more value than the cheapETH chain.

107 Oct 12, 2022
Learn Blockchains by Building One, A simple Blockchain in Python using Flask as a micro web framework.

Blockchain ✨ Learn Blockchains by Building One Yourself Installation Make sure Python 3.6+ is installed. Install Flask Web Framework. Clone this repos

Vaibhaw 46 Jan 05, 2023
A python implementation of our standard object-oriented encryption package, shipped with most apps.

Encryption Manager (python edition) VerseGroup's native encryption manager adapted for python applications. Function Generate new set of private and p

Verse Group LLC 2 Oct 30, 2022
How to setup a multi-client ethereum Eth1-Eth2 merge testnet

Mergenet tutorial Let's set up a local eth1-eth2 merge testnet! Preparing the setup environment In this tutorial, we use a series of scripts to genera

Diederik Loerakker 24 Jun 17, 2022
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
Cryptocurrency Exchange Websocket Data Feed Handler

Cryptocurrency Exchange Websocket Data Feed Handler

Bryant Moscon 1.6k Dec 31, 2022