There is well known method of message authentication method, when in addition to message used HMAC(secret, message_text). Where HMAC is algorithm described in wikipedia.
Bruce Schneier in book named "Applied Cryptography", in section
18.14, writes that MAC in form H(K1, H(K2, M)), for example, is more preferable than just H(K, M), because in second case message can be made longer by cracker. And in the book is reference to other book "1265. B. Preneel, personal communication, 1995." which is inaccessible for me.I not understood, in my case, where all messages has *fixed*
*length*, why adding HMAC to message is better than just adding hash of key mixed with message? May be somebody points me to other sources of information.