# Module: crypto/cmac

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

Source:
  - crypto/cmac.js, line 1

### Members

#### (inner, constant) blockLength

This implementation of CMAC is based on the description of OMAC in http://web.cs.ucdavis.edu/~rogaway/papers/eax.pdf. 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.

Source:
  - crypto/cmac.js, line 27

### Methods

#### (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.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Uint8Array |
`padding` | Uint8Array |

Source:
  - crypto/cmac.js, line 38