z1, P); (v, e, Rez2, P) ; = Rez1 * Rez2;% = P; = temp; (File, 0, SEEK_END); = ftell (File); (File, 0, SEEK_SET); = new unsigned char [FileLen + 4]; [0] = ( z>> 3 * 8) & 0xff; [1] = (z>> 2 * 8) & 0xff; [2] = (z>> 1 * 8) & 0xff; [ 3] = (z>> 0 * 8) & 0xff; (S +4, sizeof (unsigned char), FileLen, File); = CRC32Count (S, FileLen + 4); (e == e1) false ; true;
} main ()
{int Pr, P, q, b, a, v, e, y; * MFile, * AFile, * TFile, * SFile; temp [512];
{<<"Enter n1 to gen general parametrs n2 to gen keys for A n3 to sign a file n4 to check sign n0 to exit nВ»;>> Pr;. get (); (Pr == 1)
{(P, q, b); = fopen (MFILE, В«wbВ»); (& P, sizeof (unsigned int), 1, MFile); (& q, sizeof (unsigned int), 1 , MFile); (& b, sizeof (unsigned int), 1, MFile); (MFile); <<В«General parametrs were gened! nВ»;. get ();
} (Pr == 2)
{= fopen (MFILE, В«rbВ»); (& P, sizeof (unsigned int), 1, MFile); (& q, sizeof (unsigned int), 1, MFile); (& b , sizeof (unsigned int), 1, MFile); (MFile); (P, q, b, a, v); = fopen (AFILE, В«wbВ»); (& a, sizeof (unsigned int), 1 , AFile); (& v, sizeof (unsigned int), 1, AFile); (AFile); <<В«Personal parametrs were gened! nВ»;. get ();
} (Pr == 3)
{<<В«Enter the name of the file to sign: nВ»;. getline (temp, 512); = fopen (temp, В«rbВ»); = fopen (MFILE, В«rbВ»); = fopen (AFILE, В«rbВ»); (& P, sizeof (unsigned int), 1, MFile); (& q, sizeof (unsigned int), 1, MFile); (& b, sizeof (unsigned int), 1, MFile); (& a, sizeof (unsigned int), 1, AFile); (P, q, b, a, TFile, e, y); (TFile); fclose (AFile); fclose (MFile); = fopen (SFILE, В«wbВ»); (& e, sizeof (unsigned int), 1, SFile); (& y, sizeof (unsigned int), 1, SFile); (SFile); <<В«The file was signed! nВ»;. get ();
} (Pr == 4)
{<<В«Enter the name of the signed file: nВ»;. getline (temp, 512); = fopen (temp, В«rbВ»); = fopen (MFILE, В«rbВ»); = fopen (AFILE, В«rbВ»); = fopen (SFILE, В«rbВ»); (& P, sizeof (unsigned int), 1, MFile); (& q, sizeof (unsigned int), 1, MFile) ; (& b, sizeof (unsigned int), 1, MFile); (AFile, 4, SEEK_SET); (& v, sizeof (unsigned int), 1, AFile); (& e, sizeof (unsigned int ), 1, SFile); (& y, sizeof (unsigned int), 1, SFile); (CheckSign (P, b, v, e, y, TFile)) <<В«The sign is WRONG! n В»; <<В« The sign is correct! n В»;. get (); (TFile); fclose (MFile); fclose (AFile); fclose (SFile);
}
} while (Pr);
}