I'm trying to understand Bitcoin protocol, and sometimes see instructions like this:
The TransactionId is defined by SHA256(SHA256(txbytes))
or
The hash of the public key is generated by performing a SHA256 hash on the public key, and then performing a RIPEMD160 hash on the result, with Big Endian notation. The function could look like this: RIPEMD160(SHA256(pubkey))
For what purpose do hash calculatig twice?
"A common rationale for hashing twice is to guard against the length-extension property of the hash"
Full answer here https://crypto.stackexchange.com/questions/50017/why-hashing-twice