Should I use HMAC or KMAC for SHA3? 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) &lt; 22040 and 0 ≤ L &lt; 22040 and len(S) &lt; 22040


newX = bytepad(encode_string(K), 168) || X || right_encode(L).
return cSHAKE128(newX, L, “KMAC”, S).
Could anyone help ? which method we should use
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 ?


Yes, $mac = \text{SHA3}(k||m)$ is a secure MAC if $k$ is a fixed-length key. This is an explicit design goal of SHA3.

You can also rely on HMAC or KMAC instantiated with SHA3. These will also give you secure MACs but the added complexity is not necessary.