Bonjour,
Je débute en C++ et on m'a possé un colle pour ce weekend.
On me demande a partir d'une fonction de cryptage :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
std::string EncryptPassword(std::string Key, std::string Password)
   {
       char HASH[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
       't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
       'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'};
       std::string _Crypted = "#1";
       for(int i = 0; i < Password.length(); i++)
       {
           char PPass = Password[i];
           char PKey = Key[i];
           int APass = (int)PPass / 16;
           int AKey = (int)PPass % 16;
           int ANB = (APass + (int)PKey) % sizeof(HASH);
           int ANB2 = (AKey + (int)PKey) % sizeof(HASH);          
           _Crypted += HASH[ANB];
           _Crypted += HASH[ANB2];
       }
       return _Crypted;
   }
de crée la fonction de decryptage correspondante cependant je n'y arrive pas, quelqu'un peut il m'aider ?

Merci !