passed - i_pad and o_pad can be written as just string.char(0x36):rep(64) and string.char(0x5c):rep(64) respectively.
assertion error - The loop for concatenating i_key_pad and message is pointless, you could directly do i_key_pad .. message. Same for the second concat loop.
passed - left_pad could be written as just s:rep(#str - len) .. str.
passed - The loop in generate_secret could be replaced with just buf:sub(1, 20)
Thanks https://forum.minetest.net/viewtopic.php?p=429245#p429245