This section describes the CMAC extension of hash algorithm. The CMAC itself is described RFC 4493.
This library is kept only for backward compatibility purpose. For
newer application, use
(sagittarius crypto mac)
.
Provides CMAC hash algorithm.
The RFC is defined for only AES block cipher however the implementation can take any block cipher such as DES3.
CAUTION: only AES cipher is tested.
Creates a MAC object of CMAC algorithm. key must be a bytevector.
mac?
) (
message
bytevector?
) (
out
bytevector?
) :optional
start
length
mac?
)
These procedures are re-exported from (sagittarius crypto mac)
.
The name for CMAC hash algorithm, which can be used with (math hash)
library.
The following example explains, how to use it.
(import (rnrs) (rfc cmac) (math) (crypto))
(define K (generate-secret-key AES (integer->bytevector
#x2b7e151628aed2a6abf7158809cf4f3c)))
(define aes-cipher (cipher AES K))
(hash CMAC #vu8() :cipher aes-cipher)
;; => #vu8(187 29 105 41 233 89 55 40 127 163 125 18 155 117 103 70)
;; for AES-CMAC-96
(hash CMAC #vu8() :cipher aes-cipher :size (/ 96 8))
;; => #vu8(187 29 105 41 233 89 55 40 127 163 125 18)