- "with hashes like SHA or MD5 you just check the integrity."
With a SHA-256 I can also test the authenticity. If it is sure that the hash is real.
only if you receive the SHA256 hash from some other source. lets say you contact ThomasV on some other channel, like visiting him at his home and receiving hashes of the files he created.
any other way can be manipulated and simply faked. again it is not about giving you legit hash for the fake file. it gives you correct hash of the fake file and you have no way of knowing if it is ThomasV who put it there or a hacker.
- "lets say you go to Electrum.org and download Electrum.exe and hash from same place. how can you be sure Electrum.org was not hacked 10 minutes ago and the .exe file and its hash does not belong to the hacker?"
If the hash is in the PGP signature, I first check the authenticity of the signature, then I can check the authenticity of the file with the included hash.
if you check the signature then there is no need to have/check the hashes.
- " an attacker replaces the .exe and its hash with his own files. the hash is 100% correct because it is the hash of the fake .exe and you have no way of telling the difference."
An attacker can not fake a PGP signature with a contained hash! That will not do! The hash should not be open on the website, but in the signature!
if you have PGP you DO NOT need hashes.
and as someone said in the other topic, hashes will give users a
false sense of security and since many users are lazy they will only check the hash and not PGP and think it is OK now. we will soon see victims who now say they have checked the "signature" but it was a malware but in reality they skipped the sig. check.