-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsha3_224.cpp
More file actions
37 lines (31 loc) · 882 Bytes
/
sha3_224.cpp
File metadata and controls
37 lines (31 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "sha3/sha3_224.hpp"
#include "example_helper.hpp"
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <vector>
// Compile it using
//
// g++ -std=c++20 -Wall -O3 -march=native -I include examples/sha3_224.cpp
int
main()
{
constexpr size_t msg_len = 32;
std::vector<uint8_t> msg(msg_len, 0);
std::iota(msg.begin(), msg.end(), 0);
auto digest = sha3_224::sha3_224_t::hash(msg);
// Or do following, if you want to absorb message in multiple calls.
//
// std::array<uint8_t, sha3_224::DIGEST_LEN> md{};
// sha3_224::sha3_224_t hasher;
//
// hasher.absorb(msg);
// hasher.finalize();
// hasher.digest(md);
std::cout << "SHA3-224" << '\n' << '\n';
std::cout << "Message : " << to_hex(msg) << '\n';
std::cout << "Message Digest : " << to_hex(digest) << '\n';
return EXIT_SUCCESS;
}