Skip to content

A Ruby implementation of the CMAC digest algorithm, based on RFC 4493

Notifications You must be signed in to change notification settings

quadule/digest-cmac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

A Ruby implementation of the CMAC / OMAC1 digest algorithm, based on RFC 4493:
http://tools.ietf.org/html/rfc4493

Here's an example using a test vector from the RFC:

# key is 128 bits
key = ["2b7e151628aed2a6abf7158809cf4f3c"].pack('H*')

cmac = Digest::CMAC.new(OpenSSL::Cipher::Cipher.new('aes-128-cbc'), key)
cmac.update(["6bc1bee22e409f96e93d7e117393172a"].pack('H*'))
digest = cmac.digest

# unpack it into hex
digest.unpack('H*')[0] # => '070a16b46b4d4144f79bdd9dd04a287c'

About

A Ruby implementation of the CMAC digest algorithm, based on RFC 4493

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages