Bitcoin Public Key To Address Uncompressed So after searching for HOURS on here and overall on the internet, I haven't managed to find an answer to my question so I'll ask here.

So I've been trying to convert a public key into an address. I've been writing all the hashing algorithms, and tested them with online hashing websites, so they are working. Here is my code:

function getBTCAddress(public_key) 
{
   var __SHA = SHA256_hash(public_key);
   console.log("__SHA: " + __SHA);
   var RIPEMD = RIPEMD_160(__SHA);
   console.log("RIPEMD_160: " + RIPEMD);

   var new_SHA = SHA256_hash(RIPEMD.toString());
   console.log("new_SHA: " + new_SHA);
   var _new_SHA = SHA256_hash(new_SHA);
   console.log("_new_SHA: " + _new_SHA);

   var checksum = _new_SHA.slice(-8, _new_SHA.length);
   console.log("checksum:" + checksum);

   var almost_address = "00" + RIPEMD.toString() + checksum;
   console.log("almost_address:" + almost_address);

   var buffer = Buffer.from(almost_address, "hex");

   return BS58.encode(buffer);

}


For some reason it is not giving me the proper results. I'm wondering, what are the exact steps of deriving an address from a public key?

For those of your who are wondering here is what my code is doing:

  checksum = SHA256(SHA256(RIPEMD160(SHA256(public_key)))) &lt;-- get last 8 bytes

  almost_address = 0x00 (network byte) and RIPEMD160(SHA256(public_key)) and checksum &lt;-- compacted into 1 string

  address = base58(almost(address)
You're hashing the string representation of things, not the actual hash itself. Hash the bytes of the hash, not the bytes of its string representation.

All of the should operations are on the bytes themselves, not the hexadecimal representation of those bytes which is what you have done.