Guest User

enCryptMy,cpp

a guest
Jun 25th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void enCryptMy::EncrpytMy(QString encryptText, QString localizationToSave)
  2. {
  3.     //variables for converting text to int
  4.     QString localization = localizationToSave;
  5.     QString texxt = encryptText;
  6.     QChar test;
  7.    QList <int> intArray[texxt.length()]; //converted text in ASCII format
  8.     //converting...
  9.     if (texxt.isNull())
  10.     {
  11.         return;
  12.     }
  13.     else
  14.     {
  15.         for (int d=0; d <texxt.size();d++)
  16.         {
  17.             test = texxt.at(d);
  18.             intArray[0].append(0);
  19.             intArray[d+1].append(test.toLatin1());
  20.             qDebug()<<"the code to start mission 'Mars Revolution' is :" <<intArray[d +1];
  21.         }
  22.     }
  23.     //making image
  24.     int index = 0;
  25.     int width = texxt.length();
  26.     int isok = texxt.length() % 4
  27.     qDebug()<<"width: "<<width;
  28.  
  29.     QRgb value =0;
  30.     QImage img(width,width,QImage::Format_ARGB32);
  31.  
  32.     if (isok==0)
  33.     {
  34.         for (int w = 1; w <=texxt.length(); w++)
  35.         {
  36.             //converting ints to pixels
  37.             index = w * 4;
  38.             value = qRgba(intArray[index-3], intArray[index-2], intArray[index-1],intArray[index]);
  39.             //setting pixels
  40.             img.setPixel(w,1,value);
  41.             qDebug()<<"value :"<<value; // let's see if this  is working
  42.         }
  43.         img.save("test.png"); // dunno where it saves the file, or even if it saves... It's a mystery!
  44.     }
  45.     else
  46.     {
  47.         //code to add the result of modulo to list, just to protect it from buga
  48.  
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment