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
offline half-random brute force script for Ethereum private keys

eth200swinger offline half-random brute force script for Ethereum private keys, goes from the beginning to end of range and vice versa, saves any foun

2 Oct 06, 2022
This folder contains all the assignment of the course COL759 : Cryptography & Computer Security

Cryptography This folder contains all the assignment of the course COL759 : "Cryptography & Computer Security" Assignment 1 : Encyption, Decryption &

0 Jan 21, 2022
The Intelligent Bitcoin Miner, Part II

The Intelligent Bitcoin Miner, Part II At a Glance This app simulates the behavior and profitability of Bitcoin miners for The Intelligent Bitcoin Min

Karim Helmy 20 Dec 16, 2022
Stai Beta Of Staiking Chain - Food, Water And Electricity - Worldwide

Stai Beta Of Staiking Chain - Food, Water And Electricity - Worldwide

STATION-I 2 Feb 05, 2022
TON Command Line Interface - easy smart contract manipulation

toncli The Open Network cross-platform smart contract command line interface. Easy to deploy and interact with TON smart contracts. Installation Toncl

Disintar IO 100 Dec 18, 2022
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡

⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡

11.2k Jan 09, 2023
E2EE disabling plugin for Synapse

E2EE disabling plugin for Synapse This Pluggable Module disables end-to-end encryption in a self-hosted Synapse servers. It works by stripping out req

Konstantin Sharlaimov 9 Nov 30, 2022
This is a Sharding Simulator to study blockchain scalability

Sharding Simulator This is a Sharding Simulator to study blockchain scalability. How to run on Ubuntu First make sure you have the header file for Pyt

1 Jan 23, 2022
A simple python program to sign text using either the RSA or ISRSAC algorithm with GUI built using tkinter library.

Digital Signatures using ISRSAC Algorithm A simple python program to sign text using either the RSA or ISRSAC algorithm with GUI built using tkinter l

Vasu Mandhanya 3 Nov 15, 2022
Solutions to all 6 programming assignments in Dan Boneh's course Cryptography I, in statically typed Python.

Solutions to Cryptography I programming exercises Dan Boneh from Stanford University has an excellent online course on cryptography, hosted on Courser

Axel Lindeberg 8 Dec 16, 2022
Accounting Cycle Program with Blockchain Component

In the first iteration of my accounting cycle program, I talked about adding in a blockchain component that allows the user to verify the inegrity of

J. Brandon Walker 1 Nov 29, 2021
A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

Vinay Sajip 3 Feb 01, 2022
Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure

gold-blockchain (Gold) Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of

zcomputerwiz 3 Mar 09, 2022
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
Encrypt your code without a worry. Stark utilizes the base64, hashlib and Crypto lib to encrypt your code which cannot be decrypted with any online tools.

Stark Encrypt your code without a worry. Stark utilizes the base64, hashlib and Crypto lib to encrypt your code which cannot be decrypted with any onl

cliphd 3 Sep 10, 2021
Python Dash app that tracks whale activity in cryptocurrency markets.

Introduction Welcome! This is a Python-based Dash app meant to track whale activity in buy / sell walls on crypto-currency exchanges (presently just o

Paul Jeffries 549 Dec 25, 2022
Use this script to track the gains of cryptocurrencies using historical data and display it on a super-imposed chart in order to find the highest performing cryptocurrencies historically

crypto-performance-tracker Use this script to track the gains of cryptocurrencies using historical data and display it on a super-imposed chart in ord

Andrei 25 Aug 31, 2022
theHasher Tool created for generate strong and unbreakable passwords by using Hash Functions.Generate Hashes and store them in txt files.Use the txt files as lists to execute Brute Force Attacks!

$theHasher theHasher is a Tool for generating hashes using some of the most Famous Hashes Functions ever created. You can save your hashes to correspo

SR18 6 Feb 02, 2022
Two modules that display rates of fiat currencies and cryptocurrencies

currency-rates-polybar Two modules that display rates of fiat currencies and cryptocurrencies Setup Clone the repository somewhere Move (or create sym

Peskov Sergey 2 Apr 03, 2022
Decrypting winrm traffic using password/ntlm hash

Decrypting winrm traffic using password/ntlm hash

Haoxi Tan 9 Jan 05, 2022