Narzew

Zadanie z CrackMe

Oct 28th, 2013
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. /*
  7. Zadanie z jednego CrackMe :)
  8.  
  9. Cel: Wydobyć oryginalną tablicę, posiadając wartość wynikową, w założeniu że max wartością dla jednego argumentu jest 255 i nie ma wartości ujemnych.
  10.  
  11. Udowodnienie:
  12.  
  13. Easy: 13905 i 27960
  14. Medium: 3502658 i 16181283
  15. Hard: 835928273 i 2421100305
  16. Insane: 1171036028146342866 i 4809831696093101774
  17.  
  18. */
  19.  
  20. // Easy - 5 points
  21. int crypt_easy(int *table){
  22.     int result = 0;
  23.     result += table[0];
  24.     result += table[1]*0xFF;
  25.     return result;
  26. }
  27.  
  28. // Medium - 15 points
  29. int crypt_medium(int *table){
  30.     int result = 0;
  31.     result += table[0];
  32.     result += table[1]*0xFF;
  33.     result += table[2]*0xFFFF;
  34.     return result;
  35. }
  36.  
  37. // Hard - 45 points
  38. long crypt_hard(long *table){
  39.     long result = 0;
  40.     result += table[0];
  41.     result += table[1]*0xFF;
  42.     result += table[2]*0xFFFF;
  43.     result += table[3]*0xFFFFFF;
  44.     return result;
  45. }
  46.  
  47. // Insane - 300 points
  48. long crypt_insane(long *table){
  49.     long result = 0;
  50.     result += table[0];
  51.     result += table[1]*0xFF;
  52.     result += table[2]*0xFFFF;
  53.     result += table[3]*0xFFFFFF;
  54.     result += table[4]*0xFFFFFFFF;
  55.     result += table[5]*0xFFFFFFFFFF;
  56.     result += table[6]*0xFFFFFFFFFFFF;
  57.     result += table[7]*0xFFFFFFFFFFFFFF;
  58.     return result;
  59. }
Add Comment
Please, Sign In to add comment