Implements a random oracle as explained in the verificatum verifier specification.
More...
#include <ro.hpp>
Public Member Functions |
| RO (SHAx *hash, uint32_t outlen) |
| Creates a new RO instance.
|
std::vector< uint8_t > | query (std::vector< uint8_t > d) |
| Implements a query to this random oracle.
|
Private Attributes |
SHAx * | hashfunction |
| The hashfunction used by both the PRG and this RO instance.
|
PRG * | prg |
| The PRG to use to generate the pseudo random bytes.
|
uint32_t | nout |
| A 32 bits long unsigned representation of the length of the output required.
|
std::vector< uint8_t > | vectNout |
| A representation of nout as a vector of 4 uint8_t.
|
Detailed Description
Implements a random oracle as explained in the verificatum verifier specification.
- See Also
- rotests.cpp
Definition at line 31 of file ro.hpp.
Constructor & Destructor Documentation
RO::RO |
( |
SHAx * |
hash, |
|
|
uint32_t |
outlen |
|
) |
| |
Creates a new RO instance.
- Parameters
-
hash | The hashfunction used by the PRG. |
outlen | The length of the output, it is used to set the nout attribute. |
Definition at line 20 of file ro.cpp.
{
vectNout.push_back( (outlen>>24) % 0x100);
vectNout.push_back( (outlen>>16) % 0x100);
vectNout.push_back( (outlen>> 8) % 0x100);
}
Member Function Documentation
std::vector< uint8_t > RO::query |
( |
std::vector< uint8_t > |
d | ) |
|
Implements a query to this random oracle.
- Parameters
-
- Returns
- The result of the query, a vector of bits of length nout.
Definition at line 32 of file ro.cpp.
{
padding = (
nout%8 == 0) ? 0 :
in.insert(in.end(), d.begin(), d.end());
std::vector<uint8_t> out;
for (unsigned int i=0; i<len; i++)
for (unsigned int i=8; i>=8-padding; i--)
out[0] &= ~(1<<i);
return out;
}
Member Data Documentation
SHAx* cryptoTools::RO::hashfunction |
|
private |
The hashfunction used by both the PRG and this RO instance.
Definition at line 38 of file ro.hpp.
uint32_t cryptoTools::RO::nout |
|
private |
A 32 bits long unsigned representation of the length of the output required.
Definition at line 50 of file ro.hpp.
PRG* cryptoTools::RO::prg |
|
private |
The PRG to use to generate the pseudo random bytes.
Definition at line 43 of file ro.hpp.
std::vector<uint8_t> cryptoTools::RO::vectNout |
|
private |
A representation of nout as a vector of 4 uint8_t.
The aim of this attribute is to avoid computing this representation each time the RO is queried. Rather than performances, the quest for code simplicity lead to its existence.
Definition at line 60 of file ro.hpp.
The documentation for this class was generated from the following files: