# Hash Function Vs Signature Vs MAC?

and Found this amazing answer: https://crypto.stackexchange.com/a/5647

But one question remains:

I know that for huge input Hash's Output is much smaller, SIG's Output is of same size, but what about MAC's Output?

If MAC's Output is of same size isn't there something that combines both short output and using keys for encryption (ie SIG and Hash Together?)

• Any help please? I have an exam tomorrow and need clear answer if possible :) Jul 25, 2022 at 13:56

## 1 Answer

I know that for huge input Hash's Output is much smaller, SIG's Output is of same size, but what about MAC's Output?

The vast majority of signature schemes in use today produce constant-size signatures, irrespective of the size of message they sign. Exceptions would be signature schemes with message recovery, where the message is embedded in the signature - but those are exceedingly rare.

Similarly MAC constructions produce constant-size authentication tags, irrespective of the message size, too.

The usual way by which this is achieved for signature schemes is by use of a (cryptographic) hash function - e.g. the first step of the RSASSA-PSS signature scheme is to hash the message. For MACs there are more diverse approaches, with both cryptographic hash functions (e.g. HMAC) as well as 'truncation' of the output (e.g. CBC-MAC) coming to mind.

The difference between a MAC and a signature scheme is then twofold. Firstly the former is part of symmetric cryptography while the later is part of asymmetric (or public-key) cryptography. Secondly the formal properties they strive to achieve differ - for details on that check any standard textbook, or also the post you linked above.

I do not understand your second question:

If MAC's Output is of same size isn't there something that combines both short output and using keys for encryption (ie SIG and Hash Together?)

If there is something left unclear, please clarify what you mean by 'same size', and 'combines short output and using keys'.

• Are there any signature schemes giving message recovery where the signature size depends on the plaintext message? For RSA you can have full message recovery or partial message recovery, but afaik the signature itself always remains the same size. Jul 26, 2022 at 8:34
• @MaartenBodewes Agreed, as far as the 'pure' signature part of those schemes is concerned, I also cannot think of one where it depends on the size of the message. I have encountered signature schemes with message recovery supporting arbitrary-sized messages, where they encode as much as possible in what we'd call the 'signature', and then output this, along with the remainder of the message, as a structure they termed 'signature'. The size of that one will naturally depend on the size of the message. I suppose it comes down to terminology. Jul 26, 2022 at 12:47