byte | (LFSR_stage (S, pol, l) lt; lt; i);
} byte;
} MGamm (unsigned char * Src, int LenByte, unsigned char * Key, unsigned char * Dst, int LenKey)
{i=0; (int p=0; i lt; LenByte; i ++, p=(p ++)% LenKey)
{[i]=Src [i] ^ Key [p];
} [i]=0;
} Write_M (char * name_file, unsigned char * message, int lm)
{* fc=fopen (name_file, wb ); (message, 1, lm, fc); (fc);
} GetSize (char * name_file)
{* fm=fopen (name_file, rb ); (fm, 0, SEEK_END); lm=ftell (fm); (fm, 0, SEEK_SET); (fm); lm ;
} Read_M (char * name_file, unsigned char * message)
{lm=GetSize (name_file); * fm=fopen (name_file, rb ); (fm, 0, SEEK_SET); (message, 1, lm, fm); (fm) ;
} ClearState (unsigned char * st, int l, int pol_3)
{[l - 1]=st [l - 1] amp; (0xFFFFFFFF gt; gt; ((l * 8) -pol_3));
} main ()
{unsigned char * mes, * mes1, * cr; char key [256]; Fname [100]; lt; lt; Enter name: raquo ;; gt; gt; Fname; lenF =GetSize (Fname);=new unsigned char [lenF]; (int i=0; i lt; lenF; i ++)
{[i]=0;
}=new unsigned char [lenF];=new unsigned char [lenF]; _ M (Fname, mes); rez=true; char pin [4]={0,0,0,0 };
{= true; lt; lt; Enter PIN: raquo ;; gt; gt; pin; (int i=0; i lt; 4; i ++) (pin [i] == 0 )=false;
} (! rez); int pol [4]={2,3,10,166}; l_st=(pol [3]/8) +1; char * state=new unsigned char [l_st ]; (int i=0; i lt; l_st + 1; i ++) [i]=pin [i% 4]; [l_st - 1]=0; (state, l_st, pol [3]); (int i= 0; i lt; l_st * 8; i ++) _ stage (state, pol, l_st); (int i=0;ilt;256;i++)[i]=GenByte(state,pol,l_st);(mes,lenF,key,cr,256);(cr,lenF,key,mes1,256);_M(laquo;crraquo;,cr,lenF);_M(laquo;unkodraquo;,mes1,lenF);lt;lt;laquo;Key(16-bit):raquo;;(int i=0; i lt; 256; i ++) (% X , key [i]); lt; lt; endl; ( pause ); 0;
}
Додаток Б
ПРИКЛАД РЕАЛІЗАЦІЇ
Рисунок Б.1 - Приклад виконання роботи програми