Ruby C extension for the AES-CMAC keyed hash function (RFC 4493)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This gem implements the CMAC keyed hash function as described in RFC 4493. The CMAC function is written as a low-level C extension on top of OpenSSL, for speed and compatibility.

AES-CMAC provides stronger assurance of data integrity than a checksum or an error-detecting code. The verification of a checksum or an error-detecting code detects only accidental modifications of the data, while CMAC is designed to detect intentional, unauthorized modifications of the data, as well as accidental modifications.

AES-CMAC achieves a security goal similar to that of HMAC. Since AES-CMAC is based on a symmetric key block cipher, AES, and HMAC is based on a hash function, such as SHA-1, AES-CMAC is appropriate for information systems in which AES is more readily available than a hash function.


gem install cmac-rb


require 'cmac-rb'

digest =
tag = digest.update(plaintext)



This program is released under the GNU Affero General Public License.