Advertisement
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/RScbE00T
- Algorithme.h : http://pastebin.com/An8XnG2D
- */
- int main(int argc, char *argv[])
- {
- srand(time(NULL));
- while(1)
- {
- char messagesNonCrypte[TAILLE_MAX] = "", messagesCrypte[TAILLE_MAX] = "";
- long cle = 0, choix = 0;
- printf("\nChoix 1 : Chiffrement\nChoix 2 : Dechiffrement\nChoix 3 : Montrer ancien message\nChoix 4 : Quitter\nVotre choix ? ");
- //scanf("%d", &choix);
- choix = lireLong();
- if(choix == 1) //Chiffrement
- {
- printf("Quelle est le message ? (utiliser \"_\" pour les espaces)\nMessage : ");
- lire(messagesNonCrypte,TAILLE_MAX);
- //scanf("%s",messagesNonCrypte);
- printf("Quelle est la cle ?\nCle : ");
- //scanf("%d",&cle);
- cle = lireLong();
- 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);
- lire(messagesCrypte,TAILLE_MAX);
- printf("Quelle est la cle ?\nCle : ");
- //scanf("%d",&cle);
- cle = lireLong();
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement