Code Monkey home page Code Monkey logo

crypto-mimats's Introduction

Exemple de systèmes cryptographiques

Réalisés dans le cadre du M1 MIMaTS au sein de l'UFR de Tours.

Utilisation d'un alphabet codé sous forme de nombres :

A B C D E F G H I J K L M ... Z
0 1 2 3 4 5 6 7 8 9 10 11 12 ... 25

Cryptosystème césar

Utilisation d'un simple décallage sur l'alphabet utilisé.

#####Exemple de chiffrement avec une clé k = 1

    A -> A+1 = B        "TEST" -> "UFTU"
    B -> B+1 = C
    ...
    Z -> Z+1 = A

#####Déchiffrement avec k = 1

    A -> A-1 = Z        "UFTU" -> "TEST"
    B -> B-1 = A
    ...
    Z -> Z-1 = Y

Chiffrement par substitution

Un moyen simple de générer une permutation dans l'alphabet On utilise une phrase (vers d'un poème) pour générer le support de la permutation.

#####Exemple de permutation avec le vers 'Votre ame est un paysage choisi'

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
V O T R E A M S U N P Y G C H I B D F J K L Q W X Z

On rentre chaque nouvelle lettre du vers dans la table de permutation puis on complète avec le reste de l'alphabet non utilisé dans le vers.

#####Déchiffrement Pour le déchiffrement on passe de l'alphabet permuté aux antécédents des permutations.

Cryptosystème de Vigenère

Chiffrement utilisant une clé pour décaler les lettres du message

#####Exemple de chiffrement du message 'CARAMEL' la clé 'MINOU' On ajoute chaque lettre de la clée au message

	C -> C+M = O
	A -> A+I = I
	R -> R+N = E
	A -> A+O = O
	M -> M+U = G
	E -> E+M = Q
	L -> L+I = T

#####Déchiffrement avec la clé 'MINOU' On soustrait chaque lettre de la clée au message chiffré

	O -> O-M = C
	I -> I-I = A
	E -> E-N = R
	O -> O-O = A
	G -> G-U = M
	Q -> Q-M = E
	T -> T-I = L

Cryptosystème affine

Chiffrement en aX+b.

#####Exemple de chiffrement avec ae = 3 et be = 9

    A -> 3*A+9 = J      "BONJOUR" -> "MZWKZRI"
    B -> 3*B+9 = M
    ...
    Z -> 3*Z+9 = G (avec un alphabet de 26 lettres comme ci-dessus)

#####Déchiffrement de la fonction en aex+be

  1. On commence par calculer le ad et bd de la fonction inverse

    ad = ae-1 = inverse de ae dans Z/26Z
    bd = -ae-1be mod 26
    Dans notre cas ad = 9 et bd = 23

  2. On utilise la fonction 9x+23 pour déchiffrer :

     A -> 9*A+23 = X      "MZWKZRI" -> "BONJOUR"
     B -> 9*B+23 = G
     ...
     Z -> 9*Z+23 = O 
    

Chiffrement de hill

On utilise une matrice N*N pour chiffrer des blocs de N lettres.

Chiffrement RSA

On utilise une méthode d'exponentiation.

Exemple de partage de clés avec diffie-hellman

Utilisation de la librairie GMP pour le calcul de clés avec la méthode diffie-hellman.

License

Copyright (c) 2012, Mathieu Bolard All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Contact

[email protected]
http://mathieubolard.com
http://twitter.com/mattlawer

crypto-mimats's People

Contributors

gaetan1903 avatar mattlawer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

wisechiko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.