Advertisement
DraKiNs

[COD] hexDecode Pawn

Aug 18th, 2011
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.82 KB | None | 0 0
  1. /*
  2.  * @ Author: Bruno da Silva
  3.  * @ Site: www.ips-team.blogspot.com
  4.  * @ Date Hour: 17/08/2011 - 10:30
  5.  */
  6.  
  7. main()
  8. {
  9.     return print(hexDecode("48656c6c6f576f726c644272756e6f"));
  10. }
  11.  
  12. hexDecode(s[])
  13. {
  14.     new
  15.         stringTexto[500],
  16.         stringTemp[4],
  17.         alocarNumerosInts;
  18.  
  19.     for (new i; s[i]; i++)
  20.     {
  21.  
  22.         format(stringTemp, 4, "%s%s", s[i++], s[i]);
  23.        
  24.         switch (stringTemp[1])
  25.         {
  26.             case 0x58  , 0x78:          alocarNumerosInts = 0;
  27.             case 0x30 .. 0x39:          alocarNumerosInts = (stringTemp[0] << 4) | (stringTemp[1] - 0x30);
  28.             case 0x61 .. 0x66:          alocarNumerosInts = (stringTemp[0] << 4) | (stringTemp[1] - (0x61 - 0xA));
  29.             case 0x40 .. 0x46:          alocarNumerosInts = (stringTemp[0] << 4) | (stringTemp[1] - (0x41 - 0xA));
  30.         }
  31.        
  32.         format(stringTexto, 500, "%s%c", stringTexto, alocarNumerosInts);
  33.     }
  34.     return stringTexto;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement