Module: crypto/cmac

This module implements AES-CMAC on top of native AES-CBC using either the WebCrypto API or Node.js' crypto API.




(inner, constant) blockLength

This implementation of CMAC is based on the description of OMAC in As per that document:

We have made a small modification to the OMAC algorithm as it was originally presented, changing one of its two constants. Specifically, the constant 4 at line 85 was the constant 1/2 (the multiplicative inverse of 2) in the original definition of OMAC [14]. The OMAC authors indicate that they will promulgate this modification [15], which slightly simplifies implementations.



(inner) rightXorMut(data, padding)

xor padding into the end of data. This function implements "the operation xor→ [which] xors the shorter string into the end of longer one". Since data is always as least as long as padding, we can simplify the implementation.

Name Type Description
data Uint8Array
padding Uint8Array