# How to use the wiki UMAC example function?

I want to use the wiki UMAC example to protect the integrity of the communication between 2 devices. Unfortunately I am not quite sure of the meaning of the parameters and I don't want to get it wrong:

The following C function generates a 24 bit UMAC. It assumes that secret is a multiple of 24 bits, msg is not longer than secret and result already contains the 24 secret bits e.g. f(nonce). nonce does not need to be contained in msg.

void UHash24 (uchar *msg, uchar *secret, int len, uchar *result)

• msg - my message
• secret I assume it is the secret Key (present on both devices) 16 byte key which I'll duplicate as many times as necessary to make it bigger than the msg length.
• len - the msg length
• result - here I don't understand what f(nonce) mean - I have a 4 byte nonce - I assume that I should make a function to convert it to 3 byte?

I have seen in another post that secret should be f(nonce, Key) - is this a good suggestion? (f could be Tea algorithm)

Can I use the same f function, get only 3 bytes and use it for the result parameter?

• Programming questions are off-topic here. But nonetheless you can edit your question into an attempt at learning the basics of message authentication codes. – DannyNiu Jan 25 '19 at 6:17
• I think the configuration parameters of a function are allowed here, even if they are - in the end - required for a C function. Now if there were issues applying the parameters or encoding the values then it becomes more of a programming question and it would be more at home at Stackoverflow. – Maarten Bodewes Jan 25 '19 at 7:08
• @DannyNiu I am interested in the logic/concepts of the algorithm itself; after having these I can use the function correctly. – John Rastem Jan 25 '19 at 8:23
• @John Rastem When it comes to the topic of UMAC, it is amazing how unclear the explanations tend to be. I too hope that someone will respond to this important question that lacks a clear answer elsewhere on the internet. – Patriot Jul 6 '19 at 4:55