(I'm new to Bitcoin & it's technology so correct me wherever u can) .Recently I was reading about Bitcoin and it's underlying technologies. I came to know that for generating addresses Bitcoin uses RIPEMD-160(SHA-256). But most of the Bitcoin Addresses are 25 to 34 Bytes(characters) long & starts with 1 or 3. How is this possible? Is there any underlying Encryption algorithm is there along with Hashing functions like RIPEMD & SHA?
Bitcoin address is generated as follows :
First 256 bits of Private key(k) is generated using underlying operating system's pseudo random number generating function (in wallet).
Then Public key (K) = G * k. , where G is constant on the elliptic curve. i.e. equivalent to k times addition of G and the resulting point K is on the curve which is 65 Bytes.
The address is calculated by performing SHA256 followed by RIPEMD160 on public key (K). so that would be of 160 bits = 20 Bytes of address.
Now, Add version prefix 00(in hex). Perform SHA256 twice on it. Take first 4 Bytes of result and append it to (prefix || address).
Resultant would be final address.
Here you can find a step-by-step description of how bitcoin address is generated: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
Bitcoin address consists of
<version_byte><20 bytes of RIPEMD-160(SHA-256(PublicKey))><4 bytes checksum> = 25 bytes in total
Checksum is just first 4 bytes of SHA(SHA()) of previous data