You are on page 1of 1

ONE TIME PAD step 1 : start step 2 : Intialize random number generator step 3 : open input file to read

and encrypt data step 4 : open output file(cipher.txt) to write decrypted data step 5 : initilize alpha[]="abcdefghijklmnopqrstuvwxyz" step 6 : generate random one time key step 7 : call function encryptFile(input file, output file,random key) step 8 : To write decrypted message, open file cipher.txt step 9 : call function decryptFile(output file ,randomly generated key) step 10 : stop procedure encryptFile(input file,output file, key) ------------------------------------------------step 1 : while(end of input file ) a)read data from file and store to array plaintext[] b)set J=0 c)loop : i=0 to length of plaintext (1)ch <- (plaintext[i] ^key[j++])+'a'; (2)print ch (3)add ch to output file (4)if J>=length of key ,then set J=0 end loop end procedure procedure decryptFile(output file, key) -----------------------------------------------step 1: while(end of output file) (a)read data from file and store to array ciphertext[] b)set J=0 c)loop : i=0 to length of ciphertext (1)ch <- (ciphertext[i]-++])+'a')^key[j++]) (2)print ch (3)if J>=length of key ,then set J=0 end loop end procedure

You might also like