Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 71ccf48

Browse files
committed
Concept description updated #1
1 parent b83acc1 commit 71ccf48

File tree

3 files changed

+40
-24
lines changed

3 files changed

+40
-24
lines changed

docs/concepts.md

+36-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1-
# Message Authentication Codes Concepts {#mac_concepts}
1+
# Message Authentication Codes Concepts # {#mac_concepts}
22

3-
## Message Authentication Code Concept {#mac_concept}
3+
## MessageAuthenticationCode Concept ## {#mac_concept}
4+
5+
A ```MessageAuthenticationCode``` is an object intended to compute non-isomorphic permutations over particular sized integers (e.g. rijndael).
6+
7+
### Requirements ### {#block_ciphers_concepts_requirements}
8+
9+
The type ```X``` satisfies ```MessageAuthenticationCode``` if
10+
11+
Given
12+
* ```KeyType```, the type named by ```X::key_type```
13+
* ```BlockType```, the type named by ```X::block_type```
14+
* ```DigestType```, the type named by ```X::digest_type```
15+
16+
The following type members must be valid and have their specified effects
17+
18+
|Expression |Type |Requirements and Notes |
19+
|-----------------------------|----------------|-------------------------------|
20+
|```X::block_type``` |```BlockType``` |```BlockType``` type is a ```SequenceContainer``` of type ```T``` or ```std::array<T>```|
21+
|```X::word_type``` |```WordType``` |```WordType``` type satisfies ```Integral``` concept|
22+
|```X::digest_type``` |```DigestType```|```DigestType``` type is a ```SequenceContainer``` of type ```T```|
23+
24+
The following static data member definitions must be valid and have their specified effects
25+
26+
|Expression |Type |Requirements and Notes |
27+
|--------------------|-----------------|---------------------------------------|
28+
|```X::digest_bits```|```std::size_t```|```Integral``` bits amount in ```DigestType```|
29+
|```X::key_bits``` |```std::size_t```|```Integral``` bits amount in ```KeyType```|
30+
|```X::block_bits``` |```std::size_t```|```Integral``` bits amount in ```BlockType```|
31+
|```X::block_words```|```std::size_t```|```Integral``` amount of ```WordType``` values in ```BlockType```|
32+
33+
The following expressions must be valid and have their specified effects
34+
35+
|Expression |Requirements |Return Type |
36+
|---------------------------|------------------|-------------------------------|
37+
|```X(key_type)```|Constructs stateful ```MessageAuthenticationCode``` object with input key of ```key_type```|```MessageAuthenticationCode```|

include/nil/crypto3/mac/algorithm/compute.hpp

+2-21
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@
1010
#ifndef CRYPTO3_MAC_COMPUTE_HPP
1111
#define CRYPTO3_MAC_COMPUTE_HPP
1212

13-
#include <boost/assert.hpp>
14-
#include <boost/concept_check.hpp>
15-
16-
#include <boost/range/begin.hpp>
17-
#include <boost/range/end.hpp>
18-
#include <boost/range/concepts.hpp>
13+
#include <nil/crypto3/mac/mac_value.hpp>
14+
#include <nil/crypto3/mac/mac_state.hpp>
1915

2016
namespace nil {
2117
namespace crypto3 {
@@ -32,21 +28,6 @@ namespace nil {
3228
* interface similar to STL algorithms' one.
3329
*/
3430

35-
namespace detail {
36-
template<typename Encoder, typename InputIterator, typename OutputIterator>
37-
OutputIterator compute_impl(InputIterator first, InputIterator last, OutputIterator out, Encoder pred) {
38-
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
39-
40-
BOOST_STATIC_ASSERT(std::numeric_limits<value_type>::is_specialized);
41-
42-
pred.compute(first, last);
43-
44-
typename Encoder::result_type result = pred.get();
45-
46-
return std::move(result.begin(), result.end(), out);
47-
};
48-
} // namespace detail
49-
5031
/*!
5132
* @brief
5233
*

include/nil/crypto3/mac/hmac.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#ifndef CRYPTO3_MAC_HMAC_HPP
1111
#define CRYPTO3_MAC_HMAC_HPP
1212

13+
#include <nil/crypto3/detail/pack.hpp>
14+
1315
#include <nil/crypto3/mac/detail/hmac/accumulator.hpp>
1416
#include <nil/crypto3/mac/detail/hmac/hmac_policy.hpp>
15-
#include <nil/crypto3/mac/detail/pack.hpp>
1617

1718
#include <nil/crypto3/hash/hash_state.hpp>
1819
#include <nil/crypto3/hash/algorithm/hash.hpp>

0 commit comments

Comments
 (0)