Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kleinernik/elixir-aes-cmac
AES CMAC (rfc 4493) in Elixir
https://github.com/kleinernik/elixir-aes-cmac
Last synced: 3 months ago
JSON representation
AES CMAC (rfc 4493) in Elixir
- Host: GitHub
- URL: https://github.com/kleinernik/elixir-aes-cmac
- Owner: kleinernik
- License: mit
- Created: 2016-03-13T21:22:35.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-08T12:29:59.000Z (about 5 years ago)
- Last Synced: 2024-10-12T21:29:23.691Z (4 months ago)
- Language: Elixir
- Size: 88.9 KB
- Stars: 9
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - AES CMAC ([RFC 4493](https://tools.ietf.org/html/rfc4493)) in Elixir. (Cryptography)
- fucking-awesome-elixir - aescmac - AES CMAC ([RFC 4493](https://tools.ietf.org/html/rfc4493)) in Elixir. (Cryptography)
- awesome-elixir - aescmac - AES CMAC ([RFC 4493](https://tools.ietf.org/html/rfc4493)) in Elixir. (Cryptography)
README
# Hint for users of OTP >= 20
Since OTP 20 the AES-CMAC is in `:crypto`
You can simply use for example:
```elixir
:crypto.cmac :"aes_cbc128", <<0x2b7e1516_28aed2a6_abf71588_09cf4f3c::128>>,<<0x6bc1bee2_2e409f96_e93d7e11_7393172a_ae2d8a57_1e03ac9c_9eb76fac_45af8e51_30c81c46_a35ce411::320>>
```
See in [Erlang sources](https://github.com/erlang/otp/blob/83e20c62057ebc1d8064bf57b01be560cd244e1d/lib/crypto/src/crypto.erl#L159)# Aescmac
Implementation of [rfc4493](https://tools.ietf.org/html/rfc4493) in elixir using :crypto from erlang for aes.
All [tests from rfc4493](https://tools.ietf.org/html/rfc4493#page-11) passing.
Aescmac.aes_cmac takes two binaries, the key and the message, where the key has to be 128bit
Usage example:
```elixir
# Aescmac.aes_cmac(key, message)
<<0x070a16b4_6b4d4144_f79bdd9d_d04a287c::128>> = Aescmac.aes_cmac(<<0x2b7e1516_28aed2a6_abf71588_09cf4f3c::128>>,<<0x6bc1bee2_2e409f96_e93d7e11_7393172a::128>>)
```## Documentation
Docs can be found [at hexdocs.pm](https://hexdocs.pm/aescmac/).
## Installation
[Available in Hex](https://hex.pm/packages/aescmac), the package can be installed with:
1. Add aescmac to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:aescmac, "~> 0.0.1"}]
end
```2. Ensure aescmac is started before your application:
```elixir
def application do
[applications: [:aescmac]]
end
```