If you want to write a script for hash collision you usually want to use the same hash algorithms not 2 different ones (SHA1 and HASH160).
Collision is already taken, I think about preimage. HASH160 is used to set target for that preimage, in this way it would be impossible for miners to steal that coins from the winner, because only the author of the solution will know the private key.
Also the second OP_2DUP needs to be OP_SWAP so that you "swap" the 2 stack items and hash the other item.
Without duplication, that public key would be lost during hashing, so using OP_CHECKSIG later would always evaluate to false.
There is also no need for a OP_CheckSig in a hash collision script.
Without it, any miner could steal coins from the winner. This is not a collision, this is preimage. Something like "OP_SHA1 <160-bit zero value> OP_EQUAL" would also work, but in this way any miner could take that coins. Here, instead of some predefined value, you can take your public key, hash it, and then try to create preimage using any message that hashes to this value.
the first part where it checks that something != pubkey is useless since SHA1 is not the same as HASH160
Good point, so the first four opcodes can be skipped:
decodescript a76e75a988ac
{
"asm": "OP_SHA1 OP_2DUP OP_DROP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG",
"type": "nonstandard",
"p2sh": "2MvtHZjt8oeLFv21TmmpaEy79ZXJa1D5Eke",
"segwit": {
"asm": "0 c41cd68d0bc660607174343ab0f31638f7977faaab3c3022b1fcebd76dda6fd9",
"hex": "0020c41cd68d0bc660607174343ab0f31638f7977faaab3c3022b1fcebd76dda6fd9",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"tb1qcswddrgtcesxqut5xsatpuck8rmewla24v7rqg43ln4awmw6dlvsnphpn6"
],
"p2sh-segwit": "2NBQZBHBPNuhNDwCPoZP1cetPcEany2GBhR"
}
}
[signature][publicKey][sha1image] //OP_SHA1
[signature][publicKey][sha1(sha1image)] //OP_2DUP
[signature][publicKey][sha1(sha1image)][publicKey][sha1(sha1image)] //OP_DROP
[signature][publicKey][sha1(sha1image)][publicKey] //OP_HASH160
[signature][publicKey][sha1(sha1image)][hash160(publicKey)] //OP_EQUALVERIFY
[signature][publicKey] //OP_CHECKSIG
[1]