I am planning to implement a MAC function for the SHA3. I read that its latest variant is KMAC. I am confused by the comments in the http://keccak.noekeon.org/ website. Its says...
Unlike SHA-1 and SHA-2, Keccak does not have the length-extension weakness, hence does not need the HMAC nested construction. Instead, MAC computation can be performed by simply prepending the message with the key.
Also
KMAC is a keyed hash function or pseudo-random function (PRF) that can be used, e.g., to compute a message authentication code (MAC) or to derive a session key from a master key. It is more efficient than HMAC by removing the need for HMAC's nested construction.
So if I want to implement a MAC function Can i just do the first method ?? just pad the message with key and do the hash ? Or do I need to follow the KMAC steps?
KMAC128(K, X, L, S): Validity Conditions: $len(K) < 2^{2040}$ and $0 \leq L < 2^{2040}$ and $len(S) < 2^{2040}$
- newX = bytepad(encode_string(K), 168) || X || right_encode(L).
- return cSHAKE128(newX, L, “KMAC”, S). Could anyone help ? which method we should use