Skip to content

Commit

Permalink
clean up docs, use constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
cmazakas committed Oct 23, 2024
1 parent 2f3bde3 commit 14d525c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions doc/hash2/reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ include::reference/ripemd.adoc[]
## hash_append

### <boost/hash2/hash_append.hpp>

14 changes: 7 additions & 7 deletions doc/hash2/reference/sha2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using hmac_sha2_512_224 = hmac<sha2_512_224>;
} // namespace boost
```

This header implements the https://csrc.nist.gov/pubs/fips/180-4/upd1/final[sha-2] family of functions.
This header implements the https://csrc.nist.gov/pubs/fips/180-4/upd1/final[SHA-2] family of functions.

## sha2_256

Expand All @@ -42,7 +42,7 @@ class sha2_256
using result_type = std::array<unsigned char, 32>;
using size_type = std::uint64_t;

static const int block_size = 64;
static constexpr int block_size = 64;

sha2_256();
explicit sha2_256( std::uint64_t seed );
Expand Down Expand Up @@ -127,7 +127,7 @@ using result_type = std::array<unsigned char, 28>;

Otherwise, all other operations and constants are identical.

The message digest is obtained by truncating the final results of the SHA-256 algorithm to its left-most 224 bits.
The message digest is obtained by truncating the final results of the SHA-256 algorithm to its leftmost 224 bits.

## sha2_512

Expand All @@ -137,7 +137,7 @@ class sha2_512
using result_type = std::array<unsigned char, 64>;
using size_type = std::uint64_t;

static const int block_size = 128;
static constexpr int block_size = 128;

sha2_512();
explicit sha2_512( std::uint64_t seed );
Expand Down Expand Up @@ -222,7 +222,7 @@ using result_type = std::array<unsigned char, 48>;

Otherwise, all other operations and constants are identical.

The message digest is obtained by truncating the final results of the SHA-512 algorithm to its left-most 384 bits.
The message digest is obtained by truncating the final results of the SHA-512 algorithm to its leftmost 384 bits.

## sha2_512_224

Expand All @@ -235,7 +235,7 @@ using result_type = std::array<unsigned char, 28>;

Otherwise, all other operations and constants are identical.

The message digest is obtained by truncating the final results of the SHA-512 algorithm to its left-most 224 bits.
The message digest is obtained by truncating the final results of the SHA-512 algorithm to its leftmost 224 bits.

## sha2_512_256

Expand All @@ -248,4 +248,4 @@ using result_type = std::array<unsigned char, 32>;

Otherwise, all other operations and constants are identical.

The message digest is obtained by truncating the final results of the SHA-512 algorithm to its left-most 256 bits.
The message digest is obtained by truncating the final results of the SHA-512 algorithm to its leftmost 256 bits.
14 changes: 7 additions & 7 deletions include/boost/hash2/sha2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct sha2_base
{
Word state_[ 8 ];

static int const N = M;
static constexpr int N = M;

unsigned char buffer_[ N ];
std::size_t m_; // == n_ % N
Expand Down Expand Up @@ -317,7 +317,7 @@ class sha2_256 : detail::sha2_256_base
using result_type = std::array<unsigned char, 32>;
using size_type = std::uint64_t;

static const int block_size = 64;
static constexpr int block_size = 64;

sha2_256()
{
Expand Down Expand Up @@ -393,7 +393,7 @@ class sha2_224 : detail::sha2_256_base
using result_type = std::array<unsigned char, 28>;
using size_type = std::uint64_t;

static int const block_size = 64;
static constexpr int block_size = 64;

sha2_224()
{
Expand Down Expand Up @@ -472,7 +472,7 @@ class sha2_512 : detail::sha2_512_base

using detail::sha2_512_base::update;

static int const block_size = 128;
static constexpr int block_size = 128;

sha2_512()
{
Expand Down Expand Up @@ -548,7 +548,7 @@ class sha2_384 : detail::sha2_512_base
using result_type = std::array<unsigned char, 48>;
using size_type = std::uint64_t;

static int const block_size = 128;
static constexpr int block_size = 128;

using detail::sha2_512_base::update;

Expand Down Expand Up @@ -626,7 +626,7 @@ class sha2_512_224 : detail::sha2_512_base
using result_type = std::array<unsigned char, 28>;
using size_type = std::uint64_t;

static int const block_size = 128;
static constexpr int block_size = 128;

using detail::sha2_512_base::update;

Expand Down Expand Up @@ -705,7 +705,7 @@ class sha2_512_256 : detail::sha2_512_base
using result_type = std::array<unsigned char, 32>;
using size_type = std::uint64_t;

static int const block_size = 128;
static constexpr int block_size = 128;

using detail::sha2_512_base::update;

Expand Down

0 comments on commit 14d525c

Please sign in to comment.