The HMAC accepts a HASH (key) and uses it as a key if the key is longer than the size of the internal hash block. Thus, a key that exceeds the size of the internal hash block does not provide better security than one of the peers. Shorter keys have a value of zero equal to the internal size of the hash block in accordance with the HMAC specification.
Cannot use 128-bit key with HMAC-SHA-256. If you mean 128 bits filled up to 512 bits with zeros, then this is probably suitable for short-term authentication. I would recommend at least 256 bits, and ideally you would like to use something equal to the internal block size of the main hash.
source share