Please Consider: English is My Second Language

This Wikipedia article on HMACs shows a part of a HMAC-MD5 implementation making use of i_key_pad and o_key_pad:

# [...]

def hmac_md5(key, msg):
    if len(key) > blocksize:
        key = md5(key).digest()
    key = key + bytearray(blocksize - len(key))
    o_key_pad = key.translate(trans_5C)
    i_key_pad = key.translate(trans_36)
    return md5(o_key_pad + md5(i_key_pad + msg).digest())

# [...]

I really don't know how to even search this further, by I think I understand why they are used (padding). However I was wanting to find out if they also play a role in making the function more secure, and if so, why and how, if they are constant and public?

I could probably do the reading myself; I did try to search for this, but it seems such a specific topic that I, not being a native English speaker, could not find the appropriate English term for further research: if anyone could be kind enough to provide a link or a pointer, I shall be pretty appreciative.

  • 1
    $\begingroup$ Note that in the code you quote o_key_padand i_key_pad are not public and constant. They are the "padded" versions of the key. $\endgroup$ – otus Aug 31 '15 at 5:16
  • 1
    $\begingroup$ I hope you don't mind that we closed this as a dupe (it's kind of providing a link). If you think there are things from the answer that you don't understand then please comment here. $\endgroup$ – Maarten Bodewes Aug 31 '15 at 11:28
  • $\begingroup$ @MaartenBodewes - absolutely not; to the contrary: I appreciate your kindness. The important thing is to spread the knowledge. Thank you. $\endgroup$ – Cyan Sep 1 '15 at 20:44

Browse other questions tagged or ask your own question.