{"size": 1194, "ext": "scrbl", "max_stars_repo_path": "doc/utils/rfc/cmac.scrbl", "max_stars_repo_name": "david135/sagittarius-scheme", "max_stars_repo_stars_event_min_datetime": "2015-11-07T07:13:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T03:35:14.000Z", "max_issues_repo_path": "doc/utils/rfc/cmac.scrbl", "max_issues_repo_name": "david135/sagittarius-scheme", "max_issues_repo_issues_event_min_datetime": "2016-04-28T21:59:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T08:42:21.000Z", "max_forks_repo_path": "doc/utils/rfc/cmac.scrbl", "max_forks_repo_name": "david135/sagittarius-scheme", "max_forks_repo_forks_event_min_datetime": "2016-12-28T12:41:23.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-26T20:52:02.000Z"}
{"max_stars_count": 39, "max_issues_count": 3, "max_forks_count": 4, "avg_line_length": 30.6153846154, "max_line_length": 78, "alphanum_fraction": 0.7169179229}
@; -*- coding: utf-8 -*-
@subsection[:tag "rfc.cmac"]{(rfc cmac) - CMAC library}

This section describes the CMAC extension of hash algorithm. The CMAC itself
is described @hyperlink[:href "http://tools.ietf.org/html/rfc4493"]{RFC 4493}.
The provided library make user be able to use the algorithm with the APIs of
math library's hash algorithm APIs. For the APIs detail, see
@secref["math.hash"]{Hash operations}.

@define[Library]{@name{(rfc cmac)}}
@desc{Provides CMAC hash algorithm.}

@define[Variable]{@name{CMAC}}
@desc{The name for CMAC hash algorithm.

The following example explains, how to use it.

@codeblock{
(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)
}

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.
}
