views:

41

answers:

1

i want to encrypt and decrypt video streaming using algorithm VEA in JSP.here is algorithm VEA to encrypt and decrypt :

Algoritma VEA(   
           int m,/*key length*/
           bit key[m],               /*secret key*/ 
           char *flv_video,         /*input file*/ 
           char *vea_flv_video)     /*output file*/

           int n;                   /*buffer size*/
           bit video[n];            /*input buffer*/ 
           file in;                  /*for input*/
           file out;                /*for output*/ 
           int k,l,i = 0; 
           in = open(flv_video,“r“);
           out = open(vea_flv_video,“w“);
           while(!eof(in)){
                l = read(video,n,in);
           /*read l bits*/
                for(k=0,k<l;k++){
                   switch(video[k]){
                       case(beginning of a GOP);
                       i=0;
            /*resynchronization*/ 
                       break;
                   case():
                   video[k] = video[k] xor key[i];
                   i = ++i mod m;
                 } /*end switch*/ 
              } /*end for*/
           write(video,l,out);
          } /*end while*/ 
    close(in);
    close(out);
   }
 /*end procedure*/ 
A: 

hi, this is the formatted version of the VEA algorithm above..

enter code here
Algoritma VEA(   
           int m,/*key length*/
           bit key[m],               /*secret key*/ 
           char *flv_video,         /*input file*/ 
           char *vea_flv_video)     /*output file*/

           int n;                   /*buffer size*/
           bit video[n];            /*input buffer*/ 
           file in;                  /*for input*/
           file out;                /*for output*/ 
           int k,l,i = 0; 
           in = open(flv_video,“r“);
           out = open(vea_flv_video,“w“);
           while(!eof(in)){
                l = read(video,n,in);
           /*read l bits*/
                for(k=0,k<l;k++){
                   switch(video[k]){
                       case(beginning of a GOP);
                       i=0;
            /*resynchronization*/ 
                       break;
                   case():
                   video[k] = video[k] xor key[i];
                   i = ++i mod m;
                 } /*end switch*/ 
              } /*end for*/
           write(video,l,out);
          } /*end while*/ 
    close(in);
    close(out);
   }
 /*end procedure*/ 
one