Subversion Repositories Games.Chess Giants

Rev

Rev 59 | Rev 75 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59 Rev 62
Line 952... Line 952...
952
   // quick helper to see if the program is registered. It contains an address to potential crackers.
952
   // quick helper to see if the program is registered. It contains an address to potential crackers.
953
   // Notice: user's email address may be a wchar_t array, and thus may contain Unicode characters.
953
   // Notice: user's email address may be a wchar_t array, and thus may contain Unicode characters.
954
   // /!\ WARNING: THE CRACKER MESSAGE SHOULD NEVER CHANGE, AND NEITHER SHOULD THE ALGORITHM BELOW /!\
954
   // /!\ WARNING: THE CRACKER MESSAGE SHOULD NEVER CHANGE, AND NEITHER SHOULD THE ALGORITHM BELOW /!\
955
 
955
 
956
   static const char crackermsg[] = "Please, respect my work. DON'T PUBLISH if you crack my program. Thank you and happy cracking :)";
956
   static const char crackermsg[] = "Please, respect my work. DON'T PUBLISH if you crack my program. Thank you and happy cracking :)";
-
 
957
   static const wchar_t *blacklist[] = { L"bono@fff.com" }; // those crackers didn't play fair :(
957
 
958
 
958
   unsigned long correct_activationcode;
959
   unsigned long correct_activationcode;
959
   int byte_index;
960
   int byte_index;
960
   int length;
961
   int length;
961
 
962
 
962
   // compute the maximal length of the string for which we need to checksum
963
   // compute the maximal length of the string for which we need to checksum
963
   length = wcslen (email);
964
   length = wcslen (email);
964
   if (length > sizeof (crackermsg) - 1)
965
   if (length > sizeof (crackermsg) - 1)
965
      length = sizeof (crackermsg) - 1; // bound it to the length of the cracker message
966
      length = sizeof (crackermsg) - 1; // bound it to the length of the cracker message
-
 
967
 
-
 
968
   // reuse byte_index to parse the blacklist
-
 
969
   for (byte_index = 0; byte_index < sizeof (blacklist) / sizeof (wchar_t *); byte_index++)
-
 
970
      if (_wcsicmp (blacklist[byte_index], email) == 0)
-
 
971
         return (false); // if email is blacklisted, report it to be false
966
 
972
 
967
   // hash the supplied e-mail
973
   // hash the supplied e-mail
968
   correct_activationcode = 5381; // start value
974
   correct_activationcode = 5381; // start value
969
   for (byte_index = 0; byte_index < sizeof (crackermsg) - 1; byte_index++)
975
   for (byte_index = 0; byte_index < sizeof (crackermsg) - 1; byte_index++)
970
      correct_activationcode = ((correct_activationcode << 5) + correct_activationcode)
976
      correct_activationcode = ((correct_activationcode << 5) + correct_activationcode)