user54748: This guide https://bitcoin.org/en/developer-guide#p2pkh-script-validation mentions
"The operation executed next, OP_HASH160, pushes onto the stack a hash of the data currently on top of it—in this case, Bob’s public key. This creates a hash of Bob’s public key."
Does the HASH160 operation pops the duplicated public key? If not, why keeping a duplication on the stack? what's the point?
Thanks.

user12983: OP_HASH160 pops an item from the stack (it can be a public key or any arbitrary array of bytes), hashes it and pushes the result to the stack

user38482: e.g. the script for a P2SH is:
OP_HASH160, P2SHAddress, OP_EQUAL

if whatever was on the stack, is hashed (OP_HASH160), the result of this operation is pushed back on the stack. Then the top two items on the stack are the result of the OP160 operation, and the P2SHAddress. These two are then compared. 
A good explanation is online here in Andreas' book "Mastering Bitcoin": http://chimera.labs.oreilly.com/books/1234000001802/ch05.html#p2sh

54748: <p>This guide <a href="https://bitcoin.org/en/developer-guide#p2pkh-script-validation" rel="nofollow noreferrer">https://bitcoin.org/en/developer-guide#p2pkh-script-validation</a> mentions
"The operation executed next, OP_HASH160, pushes onto the stack a hash of the data currently on top of it—in this case, Bob’s public key. This creates a hash of Bob’s public key."</p>

<p>Does the HASH160 operation pops the duplicated public key? If not, why keeping a duplication on the stack? what's the point?</p>

<p>Thanks.</p>
 12983: <p>OP_HASH160 pops an item from the stack (it can be a public key or any arbitrary array of bytes), hashes it and pushes the result to the stack</p>
 38482: <p>e.g. the script for a P2SH is:</p>

<pre><code>OP_HASH160, P2SHAddress, OP_EQUAL
</code></pre>

<p>if whatever was on the stack, is hashed (OP_HASH160), the result of this operation is pushed back on the stack. Then the top two items on the stack are the result of the OP160 operation, and the P2SHAddress. These two are then compared. 
A good explanation is online here in Andreas' book "Mastering Bitcoin": <a href="http://chimera.labs.oreilly.com/books/1234000001802/ch05.html#p2sh" rel="nofollow noreferrer">http://chimera.labs.oreilly.com/books/1234000001802/ch05.html#p2sh</a></p>
