Bitcoin addresses are computed from an initial public key or redeem script in the case of Pay To Public Key Hash (P2PKH) and Pay-To-Script-Hash (P2SH) respectively.
The address is computed by:
- SHA256 hashing the input bytes (e.g. the public key in the case of P2PKH or redeemScript in the case of P2SH)
- RIPEMD160 hashing the result of step 1
- Prepending the network byte to the hash computed in step 2
- Perform SHA256 hashing twice on the concatenated (network byte || RIPEMD160 hash) - the checksum is the first four bytes of the result.
- Appending the 4 byte checksum to the concatenated (network byte || RIPEMD160 hash), resulting in 25 bytes
- Base58 encoding the result