How are smart contract addresses (those that start with `KT1`) computed?

I would like to know whether `CHAIN_ID` is somehow used in its computation, or it is possible to have two KT1 contracts with identical addresses on different chains.