Digital Signatures, Standard Hash Functions and MACs I'm studying Hash functions and Digital Signatures in sequence, and came up with some doubts about their usage.

First of all:


What is the difference between hashing a document and signing it?
And why aren't Standard Hash Functions considered fit for message authentication?


More specifically, considering Keyed Hash functions (MACs):


Are keyed hash functions (MACs) the mechanism on which Digital Signatures are based, or are they a way to implement a particular scheme of Digital Signature (e.g HMAC provided along with the message)?
Digital Signatures, hashes and MACs can do similar jobs.  They allow someone sending a message to a check value along with the message.  They allow someone receiving the message to verify that the message corresponds to the check value.  However, a hash is an unkeyed operation; anyone can compute the hash of the message.  So, while they provide protection against accidental message modification, they cannot provide any protection from an active attacker.

Digital signatures and MACs both ensure that someone in the middle (without the key) cannot modify a message without being detected (by the check value not validating).

However, even here still a difference; with a MAC, the sender and the receiver have the same key.  So, someone in the middle (without the key) cannot forge a message; however, the receiver can himself generate a message that validates.

With a digital signature, this is not the case.  The sender has a 'signing' key, and the receiver has a 'verification' key; the verification key allows the receiver to validate messages; however, he himself cannot forge any messages.

So, if the question is "should I use a HASH, a MAC (such as HMAC), or a digital signature", well, that depends on how much you trust anyone who does the validation.  If you just want to protect accidental changes to the message, well, a hash is fine (and doesn't force you to do the bother of key management).  If what you need is to protect messages from Alice to Bob (and so Bob is the only person who will ever validate a message with that key), then a MAC is appropriate (and a lot cheaper).  On the other hand, if you are posting messages to your blog, and you want everyone to be able to verify that you are the one posting, well, everyone will need the verification key, and so in that case, a digital signature is required.