Advertisement
Guest User

priv_key to wif (bitcoin)

a guest
Nov 12th, 2013
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <form method="post">
  2. <input type="text" name="key" value="" />
  3. <input type="submit" name="submit" value="Go" />
  4. </form>
  5. <?php
  6. define("ADDRESSVERSION","80"); //this is a hex byte
  7. if(isset($_POST))
  8. {
  9.     echo hash160ToAddress(trim(strtoupper($_POST['key'])));
  10. }
  11.  
  12. function hash160ToAddress($hash160,$addressversion=null)
  13. {
  14.         if($addressversion === null)
  15.         {
  16.             $addressversion = ADDRESSVERSION;
  17.         }
  18.         $hash160=$addressversion.$hash160;
  19.         $check=pack("H*" , $hash160);
  20.         $check=hash("sha256",hash("sha256",$check,true));
  21.         $check=substr($check,0,8);
  22.         $hash160=strtoupper($hash160.$check);
  23.         return encodeBase58($hash160);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement