# how hashing algorithm is shared in public key

Here picture is provided

My question is how hashing algorithm is shared between sender and receiver?

• Usually either by context or because it is specified in the certificate. – SEJPM May 8 '18 at 14:05
• You could have a look here about how encryption with a private key compares with signature generation. Even the standard tries to avoid calling it that nowadays. – Maarten - reinstate Monica May 9 '18 at 12:02

In brain-damaged protocols, the signature or metadata around it specifies which signature scheme to use (including the choice of hash function), and the verifier will happily use it. This means that a forger can pick any weak signature scheme that the verifier supports—including completely nonsensical ones, like none, or the secret-key HMAC-SHA256 when the signer meant to use the public-key RSASSA-PSS—and persuade the verifier to use it, against the wishes of the signer.