Advertisement
IWBH_01

password hash to image

Nov 15th, 2020
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2. //convert password hash of (val) to image because why not
  3.  
  4. $img1 = @imagecreate(16,16);
  5.  
  6.  
  7. if(isset($_GET["val"]))
  8. $pf=$_GET["val"];
  9. else $pf="lal";
  10.  
  11. $val=hash("haval256,3",$pf);
  12.  
  13. $z="0000000000";
  14. $i=0;
  15. $bin="";
  16. while($i<64){
  17. $n=base_convert(substr($val,$i,8),16,2);
  18. if($L=8-strlen($n)) $n2=substr($z,0,$L).$n;
  19. else $n2=$n;
  20. $bin.=$n;
  21. $i+=8;
  22. }
  23.  
  24.  
  25. //exit("ay: ".(strlen($bin)*1));
  26.  
  27. $green=imagecolorallocate($img1, 0, 255, 0);
  28. $black=imagecolorallocate($img1, 0, 0, 0);
  29.  
  30. $i=0;
  31.  
  32. for($y = 0; $y < 16; ++$y){
  33.     for($x = 0; $x < 16; ++$x){
  34.         imagesetpixel($img1, $x, $y, ($bin[$i])*1);
  35.         $i++; if(!isset($bin[$i])) $i=5;
  36.     }
  37. }
  38.  
  39.  
  40. imagepng($img1, $val."_.png");
  41.  
  42.  
  43. echo '<br><img width=128 height=128 src="'.$val.'_.png">';
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement