Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- #include "algorithme.h"
- #define TAILLE_MAX 1000
- //algorithme.c : http://pastebin.com/d2c7RCNZ
- //algorithme.h : http://pastebin.com/jKBSFgx8
- int main(int argc, char *argv[])
- {
- srand(time(NULL));
- while(1)
- {
- char messagesNonCrypte[TAILLE_MAX] = "", messagesCrypte[TAILLE_MAX] = "";
- int cle = 0, choix = 0;
- printf("\nChoix 1 : Chiffrement\nChoix 2 : Dechiffrement\nChoix 3 : Montrer ancien message\nChoix 4 : Quitter\nVotre choix ? \n");
- scanf("%d", &choix);
- if(choix == 1) //Chiffrement
- {
- printf("Quelle est le message ? (utiliser \"_\" pour les espaces)\nMessage : ");
- scanf("%s",messagesNonCrypte);
- printf("Quelle est la cle ?\nCle : ");
- scanf("%d",&cle);
- Chiffrement(messagesNonCrypte,messagesCrypte,cle);
- Save(messagesNonCrypte,messagesCrypte,cle);
- printf("Le message crypte est : %s",messagesCrypte);
- }
- else if(choix == 2) //Dechiffrement
- {
- printf("Quelle est le message ? (utiliser \"_\" pour les espaces)\nMessage : ");
- scanf("%s",messagesCrypte);
- printf("Quelle est la cle ?\nCle : ");
- scanf("%d",&cle);
- Dechiffrement(messagesCrypte,messagesNonCrypte,cle);
- Save(messagesNonCrypte,messagesCrypte,cle);
- printf("Le message decrypte est : %s",messagesNonCrypte);
- }
- else if(choix == 3) //SAVE
- {
- AfficherSave();
- }
- else if(choix == 4) //EXIT
- {
- goto FIN;
- }
- else
- {
- printf("Erreur mauvais choix\n");
- }
- }
- FIN:
- return 0;
- }
Add Comment
Please, Sign In to add comment