Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post">
- <input type="text" name="key" value="" />
- <input type="submit" name="submit" value="Go" />
- </form>
- <?php
- define("ADDRESSVERSION","80"); //this is a hex byte
- if(isset($_POST))
- {
- echo hash160ToAddress(trim(strtoupper($_POST['key'])));
- }
- function hash160ToAddress($hash160,$addressversion=null)
- {
- if($addressversion === null)
- {
- $addressversion = ADDRESSVERSION;
- }
- $hash160=$addressversion.$hash160;
- $check=pack("H*" , $hash160);
- $check=hash("sha256",hash("sha256",$check,true));
- $check=substr($check,0,8);
- $hash160=strtoupper($hash160.$check);
- return encodeBase58($hash160);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement