SHARE
TWEET

Untitled

DilyaraL May 19th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Rezhim(ifstream &f, ifstream &inh,ofstream&ofh, ofstream&ofc)
  2. {
  3.     int** C = new int*[N];
  4.     for (int i = 0; i < N; i++)
  5.         C[i] = new int[N];
  6.  
  7.     int** P = new int*[N];//открытыe
  8.     for (int i = 0; i < N; i++)
  9.         P[i] = new int[N];
  10.  
  11.     int** y = new int*[N];
  12.     for (int i = 0; i < N; i++)
  13.         y[i] = new int[N];
  14.     y = Hash(f, ofh);
  15.  
  16.     int ***ke = new int**[13];
  17.     for (int i = 0; i < 13; i++)
  18.     {
  19.         ke[i] = new int*[N];
  20.         for (int j = 0; j < N; j++)
  21.             ke[i][j] = new int[N];
  22.     }
  23.  
  24.     ke = key(KEY);
  25.     signature(inh, ofc);
  26.     int x = 0, k = 0, I = 0, J = 0;
  27.     while (f >> x)//читаем файл
  28.     {
  29.         if ((k % 16 == 0) && (k != 0))
  30.         {
  31.             y = encryption(y, ke);
  32.             for (int i = 0; i < N; i++)
  33.                 for (int j = 0; j < N; j++)
  34.                     C[i][j] = P[i][j] + y[i][j];
  35.             for (int i = 0; i < N; i++)
  36.                 for (int j = 0; j < N; j++)
  37.                     ofc << C[i][j];
  38.         }
  39.         k++; I++; J++;
  40.         if (I % 4 == 0) I = 0;
  41.         if (J % 4 == 0) J = 0;
  42.         P[I][J] = x;
  43.     }
  44.     k = 0;
  45.     for (int l = I; l < N; l++)
  46.         for (int m = J; m < N; m++)
  47.         {
  48.             P[l][m] = rand()%256;
  49.             k++;
  50.         }
  51.     P[N - 1][N - 1] = k - 1;
  52.     y = encryption(y, ke);
  53.     for (int i = 0; i < N; i++)
  54.         for (int j = 0; j < N; j++)
  55.             C[i][j] = P[i][j] + y[i][j];
  56.     for (int i = 0; i < N; i++)
  57.         for (int j = 0; j < N; j++)
  58.             ofc << C[i][j];
  59.     signature(inh, ofc);
  60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top