cmac
Version, currently 1.0.03 versions
- 1.0.2latestNov 7, 2024
- 1.0.1not indexedNov 7, 2024
- 1.0.0not indexedNov 7, 2024
github.com/spider-gazelle/cmac
Crystal implementation of the Cipher-based Message Authentication Code (CMAC)
Nothing has been indexed for 1.0.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
cmac:
github: spider-gazelle/cmac
version: ~> 1.0.0Then run:
shards installshard.yml
No shard.yml has been indexed for 1.0.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Crystal Lang CMAC
Crystal implementation of the Cipher-based Message Authentication Code (CMAC) as defined in RFC4493, RFC4494, and RFC4615. Message authentication codes provide integrity protection of data given that two parties share a secret key.
key = Random.new.random_bytes(16)
message = "attack at dawn"
cmac = CMAC.new(key)
cmac.sign(message)
=> Bytes[246, 184, 193, 76, 93, 115, 191, 26, 135, 60, 164, 161, 90, 224, 102, 170]
Once you've obtained the signature (also called a tag) of a message you can use CMAC to verify it as well.
tag = Bytes[246, 184, 193, 76, 93, 115, 191, 26, 135, 60, 164, 161, 90, 224, 102, 170]
cmac.valid_message?(tag, message)
=> true
cmac.valid_message?(tag, "attack at dusk")
=> false
CMAC can also be used with a variable length input key as described in RFC4615.
key = "setec astronomy"
message = "attack at dawn"
cmac = CMAC.new(key)
cmac.sign(message)
=> Bytes[92, 17, 144, 230, 145, 178, 196, 130, 96, 144, 166, 236, 58, 14, 28, 243]
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.0- Tagged
- Nov 7, 2024
- Commit
00240ce5336d- Indexed
- not yet
Dependents
Repository
github.com/spider-gazelle/cmac
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 3