Code:/* Name: CRYDEC TOKI Author: KRAKZ Date: 25/02/03 23.08 Description: CRYPTA E DECRYPTA LICENZA : GNU|GPL VERSIONE : 1.0 */ int crypt () ; int decrypt () ; # include <stdio.h> # include <string.h> # include <stdlib.h> # define MAX 255 main () { int I ; printf (" *** BENVENUTO SU CRYDEC VERSIONE 1.0 ***\n\n\n") ; printf ("SELEZIONA UNA DELLE OPZIONI\n\n") ; printf ("1 - Crypta\n") ; printf ("2 - Decrypta\n") ; printf ("3 - Info autori\n") ; printf ("Digita 1, 2 o 3 \n"); scanf ("%d" , &I ) ; switch(I) { case 1 : crypt () ; break ; case 2 : decrypt () ; break ; case 3 : printf ("Krakz") ; break ; } } int crypt () { int i, I = 0 , countchiave , countfrase , crypt[MAX] ; char frase[MAX] , chiave[MAX] , nomefile[10] ; FILE *cfPtr; printf ("Benvenuto su crypt 0.5\n") ; printf ("Inserisci frase\n") ; gets(frase) ; printf ("Inserisci chiave\n") ; gets(chiave) ; printf ("Salva con nome\n") ; gets(nomefile) ; countfrase = strlen(frase) ; /* VERIFICA LA LUNGHEZZA DELLE STRINGHE */ countchiave = strlen(chiave) ; for ( i = 0 ; countfrase > i ; i++) /* CONTROLLA CHE TUTTA LA STRINGA SIA CRIPTATA */ { if ( countchiave < I) I = 0 ;; /* CONTROLLA SE SONO STATE UTILIZZATE TUTTE LE LETTERE DELLA CHIAVE SE VEDE CHE SONO STATE USATE TUTTE , RESETTA IL TUTTO PARTENDO DALLA PRIMA LETTERA */ crypt[i] = chiave[I] + frase[i] ; /* CRIPTA LA STRINGA */ if ((cfPtr = fopen( nomefile , "a")) == NULL) printf("File gia aperto\n"); if ( crypt[i] < 100 ) fprintf(cfPtr, "0" ) ;; /* VERIFICA CHE IL VALORE DATO SIA MAGGIORE DI 100 E SE RISCONTRA UN VALORE MINORE DI 100 AGGIUNGE IL VALORE 0 */ fprintf(cfPtr, "%d", crypt[i] ); /* STAMPA LA FRASE CRIPTATA */ I = 1 + I ; /* REALIZZA UNO SHIFT A DESTRA */ } fprintf(cfPtr, "\n\n\nUsa decrypt per vedere il testo\n\n" ) ; fprintf(cfPtr, "\n\n\nVersione programma 1.0\n\n" ) ; fprintf(cfPtr, "\n\n\nwww.toki.it\n\n" ) ; printf ("Il file testo è stato cryptato , per decryptarlo\n") ; system("PAUSE"); /* COMANDO COMPATIBILE SOLO CON OS WIN , RICHIEDE LA PRESSIONE DI UN TASTO PER CONTINUARE L'ESECUZIONE DEL PROGRAMMA*/ } int decrypt () { int I=0 , i , countfrase , countchiave , dEcrypt[MAX] , de = 0 ; char frase[MAX] , chiave[MAX] ; printf ("Inserisci File Cryptato\n") ; gets(frase) ; printf ("Inserisci chiave\n") ; gets(chiave) ; countfrase = strlen(frase) ; countchiave = strlen(chiave) ; for ( i = 0 ; countfrase > i ; i = 3 + i) { if ( countchiave < I) I = 0 ;; dEcrypt[de] = (frase[i]* 100 + frase [i+1] * 10 + frase [i+2] +48 ) - chiave [I] ; printf ("%c" , dEcrypt[I]) ; I = 1 + I ; } printf ("\n") ; system("PAUSE"); }
i dont know , me programm jump first gets