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 simple key-based text encryption process that encrypts a string based in a list of characteres pairs.

Simple Cipher Encrypter About | New Features | Exemple | How To Use | License ℹ️ About A simple key-based text encryption process that encrypts a stri

Guilherme Farrel 1 Oct 21, 2021
This python module can analyse cryptocurrency news for any number of coins given and return a sentiment. Can be easily integrated with a Trading bot to keep an eye on the news.

Python script that analyses news headline or body sentiment and returns the overall media sentiment of any given coin. It can take multiple coins an

185 Dec 22, 2022
Programme de chiffrement et déchiffrement affine d'un message en python3.

Chiffrement Affine En Python3 Programme de chiffrement et déchiffrement affine d'un message en python3. Explication du chiffrement affine avec complex

Malik Makkes 1 Mar 26, 2022
a BTC mining program based on python3

BTC-Miner a BTC mining program based on python3 Our project refers to the nightminer project by ricmoo, which is written in Python2 (https://github.co

6 Jul 31, 2022
Address Validator (Bitcoin & Monero)

The Bitcoin address is an identifier of 26-35 alphanumeric characters, beginning with the number 1, 3 or bc1. 0, O, I, l are removed to avoid visual a

0 Mar 29, 2022
Cryptocurrency Exchange Websocket Data Feed Handler

Cryptocurrency Exchange Websocket Data Feed Handler

Bryant Moscon 1.6k Dec 31, 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
Hide secret texts inside an image, optionally encrypt them with a password using AES-256.

Hide secret texts/messages inside an image. You can optionally encrypt your texts with a password using AES-256 before encoding into the image.

Teja Swaroop 97 Dec 29, 2022
A simple Python tool to help anyone use Liquidity Pools on the BitShares blockchain.

ACCOUNT AND ACTIVE KEY ARE NOT PERSISTENT, YOU WILL NEED TO ENTER THEM EACH TIME YOU LAUNCH THE APP (but not every transaction. that's a win). If / wh

Brendan Jensen 17 Jun 15, 2022
A tool that can encrypt python2 or python3 code with the given password and can reuse with that password

A tool that can encrypt python2 or python3 code with the given password and can reuse with that password

Md Rasel Bhuyan 3 Feb 28, 2022
seno-blockchain is just a fork of Chia, designed to be efficient, decentralized, and secure

seno-blockchain https://seno.uno Seno is just a fork of Chia, designed to be efficient, decentralized, and secure. Here are some of the features and b

Denis Erygin 27 Jul 02, 2022
SDU experiment of introduction to the cryptography

Lab 01 (2 hrs): Programming Basics Program 1: Type Hint, String, Bytes, Hex, Base64 Lab 02 (4 hrs): Classical Cryptography Part 1 (3 hrs): Program 1:

1 Jan 03, 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

5 Jul 30, 2022
This is an experimental AES-encrypted RPC API for ESP 8266.

URPC This is an experimental AES-encrypted RPC API for ESP 8266. Usage The server folder contains a sample ESP 8266 project. Simply set the values in

Ian Walton 1 Oct 26, 2021
Highly decentralized and censorship-resistant way to store key data

Beacon coin Beacon coin is a Chia singelton coin that can store data that needs to be: always available censorship resistant versioned potentially imm

Sebastjan Trepca 24 Oct 04, 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
Vaulty - Encrypt/Decrypt with ChaCha20-Poly1305

Vaulty Encrypt/Decrypt with ChaCha20-Poly1305 Vaulty is an extremely lightweight encryption/decryption tool which uses ChaCha20-Poly1305 to provide 25

Chris Mason 1 Jul 04, 2022
Bitcoin Wallet Address Generator

Bitcoin Wallet Address Generator This is a simple Bitcoin non-deterministic wallet address generator coded in Python 3. It generates a Private Key in different formats (hex, wif and compressed wif) a

11 Dec 29, 2022
A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided

A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided. If you’ve found this bot useful and have profited from it please consider donating any

473 Dec 25, 2022
Django-based Crypto Portfolio Tracker – keep an eye on Shiba Inu and other Crypto

Crypto Tracker 🐍 📈 – Central Portfolio Tracking Easy asset tracking – at a glance 🚀 Dashboard to centrally monitor current crypto portfolio develop

65 Jan 08, 2023