thieumao

AESCBCNopading PHP

Jun 25th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2. $privateKey = "d7f8g9hk0dj2s712";
  3. $iv = "f7h9a5d0gkvi7v6v";
  4. $data = "http://tivi.crackgame.net/youtubefaker/Hai-co-tien-365.mp4";
  5.  
  6.  
  7. $encrypted1 = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $privateKey, $data . "      ", MCRYPT_MODE_CBC, $iv);
  8. $encrypted2 = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $privateKey, padding($data), MCRYPT_MODE_CBC, $iv);
  9. echo $data . "mao" . strlen($data);
  10. echo "<br>";
  11. echo padding($data) . "mao" . strlen(padding($data));
  12. echo "<br>";
  13. echo strToHex($encrypted1);
  14. echo "<br>";
  15. echo strToHex($encrypted2);
  16. //echo "<br>";
  17. //echo(base64_encode($encrypted));
  18.  
  19. function strToHex($string){
  20.     $hex='';
  21.     for ($i=0; $i < strlen($string); $i++){
  22.         $hex .= dechex(ord($string[$i]));
  23.     }
  24.     return $hex;
  25. }
  26.  
  27. function padding($string){
  28.     $len = strlen($string);
  29.     $du = $len % 16;
  30.     $space = 16 - $du;
  31.     $output = $string; 
  32.     for($i=0; $i<$space; $i++){
  33.     $output = $output . " ";
  34.     }
  35.     return $output;
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment