Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.77 KB | None | 0 0
  1. <?php
  2.  
  3. function hex2str( $hex ) {
  4.   return pack('H*', $hex);
  5. }
  6.  
  7. function str2hex( $str ) {
  8.   $teste = unpack('H*', $str);
  9.   return array_shift( $teste );
  10. }
  11.  
  12. /*
  13.  * To change this license header, choose License Headers in Project Properties.
  14.  * To change this template file, choose Tools | Templates
  15.  * and open the template in the editor.
  16.  */
  17.  
  18. $decodedLayout = "{resizepic 38 125 9200 445 298}{gumppictiled 50 155 170 230 2624}{gumppictiled 240 155 232 230 2624}{checkertrans 50 155 170 230}{gumppic 451 74 10441}{htmlgump 52 130 408 20 0 0 0}{text 90 173 1152 1}{text 90 203 1152 2}{text 90 233 1152 3}{text 90 263 1152 4}{text 90 323 1152 5}{text 90 353 1152 6}{button 70 176 2117 2118 0 1 0}{button 70 206 2117 2118 0 2 0}{button 70 236 2117 2118 0 3 0}{button 70 266 2117 2118 0 4 0}{button 70 326 2117 2118 1 0 1}{button 70 356 2117 2118 1 0 2}{checkertrans 240 155 232 230}{text 90 293 1152 7}{button 70 296 2117 2118 1 0 3}{page 1}{htmlgump 244 158 226 224 8 8 0}{button 409 388 247 248 1 0 4}{page 2}{htmlgump 244 158 226 224 9 9 0}{button 409 388 247 248 1 0 5}{page 3}{text 250 173 132 10}{text 250 198 132 11}{text 250 223 132 12}{text 250 248 132 13}{text 250 273 132 14}{text 250 298 132 15}{text 250 323 132 16}{text 250 348 132 17}{text 50 393 67 18}{page 4}{htmlgump 243 158 228 225 19 19 0}";
  19. $encoded = "789C7D93DD6EC3200C85F7287E046C6C7E1EA7EB505BADEDAA964AD3A2BCFBCC4216E0A272C8C5779C83B1C9744F8FD34FBA9DF66003200944320698052886793A3C2F3715F3E99C3E400CA008A037405697231E32889714B2D4A4EC8F69FF99EEF9BEBB3E0693FFEF8105C133A061C6793AE6CBB9282004A8466C029081BF98A79CBE334435F216104BCAC6C854460DB395D986B9CA7863962A938649656E9EDE9F397F5DC1979D1D10A22FAFA04561296B93C9F4320DB2ED653BC8AE97B9972DB53296DD3B59469986110C536A7A12EB597D574E1C0DB58DB7DD21413B28621D9EE8944A75C41034B6B2D944BD60AAB2DAF0E2C2D5855EB8448DD72E525DD6D192D47BA18743D3C21816880D24AA99D442AE99AD27AD9EDCC2D5531A68574FD7C2D5D3575898B6DB79C0508FC05D236C6D4459FABFC4F298F9ED173B0DF9ED";
  20. $encodedLayout = hex2str($encoded);
  21. #zlib_decode("789C5D8B310A80301004A7117D82BFF003622582B57E2084A081708246FCBE6BA185CD2D3B3B474D8B276064DD9D8E419938453D4E6BF3DB2B194E2C13D9C40F915EBEB1C878C9F87D98EC44C9C4AA16D5838C8259EEF5D837062817C3");
  22. #echo bin2hex(zlib_encode($testeLayout, ZLIB_ENCODING_DEFLATE));
  23. #zlib_decode($encoded);
  24. $layout = str2hex($decodedLayout);
  25.  
  26. $decoLayout = zlib_decode($encodedLayout);
  27.  
  28. $binLayout = bin2hex(zlib_encode($layout, ZLIB_ENCODING_DEFLATE));
  29.  
  30. echo "ORIGINAL\n\n";
  31. echo $encoded . "\n\n";
  32. echo "CONVERTER\n\n";
  33. echo $binLayout .  "\n\n";
  34.  
  35. echo ($encoded == $binLayout) ? 'true' : 'false';
  36. echo "\n\n";
  37. echo ($decodedLayout == $decoLayout) ? 'true' : 'false';
  38. echo "\n\n";
  39.  
  40. echo strlen($encoded)."\n\n";
  41. echo strlen($binLayout)."\n\n";
  42.  
  43. echo "\n".$decodedLayout ."\n";
  44. echo $decoLayout;
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement