Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Macros
Pages
cryptotools
rotest.cpp
Go to the documentation of this file.
1
16
#include <iostream>
17
#include <iomanip>
18
#include <vector>
19
20
#include "
cryptotools.hpp
"
21
22
using namespace
cryptoTools;
23
24
25
void
printBytes
(std::vector<uint8_t> v)
26
{
27
for
(
unsigned
int
i=0; i<v.size(); i++)
28
std::cout<<std::hex<<std::setw(2)<<std::setfill(
'0'
)<<(int)v[i];
29
std::cout<<std::endl;
30
}
31
32
33
int
main
(
void
)
34
{
35
SHAx
* hash;
36
RO
* ro;
37
std::vector<uint8_t> input;
38
for
(
unsigned
int
i=0; i<32; i++)
39
input.push_back(i);
40
41
// Testing the SHA256 version
42
hash =
new
SHA256
();
43
ro =
new
RO
(hash,65);
44
printBytes
(ro->
query
(input));
45
ro =
new
RO
(hash,261);
46
printBytes
(ro->query(input));
47
48
// Testing the SHA384 version
49
hash =
new
SHA384
();
50
ro =
new
RO
(hash,93);
51
printBytes
(ro->query(input));
52
ro =
new
RO
(hash,411);
53
printBytes
(ro->query(input));
54
55
// Testing the SHA512 version
56
hash =
new
SHA512
();
57
ro =
new
RO
(hash,111);
58
printBytes
(ro->query(input));
59
ro =
new
RO
(hash,579);
60
printBytes
(ro->query(input));
61
62
63
return
0;
64
}