MOTION
0.01
Framework for mixed-protocol multi-party computation
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Variables
Typedefs
a
b
c
d
g
i
l
o
p
r
s
t
w
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
~
Variables
a
b
c
d
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
g
i
k
m
p
r
t
v
Enumerations
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
k
l
m
o
p
r
s
t
u
v
x
Functions
a
b
c
d
e
g
i
k
l
m
p
r
s
t
x
Variables
b
d
k
p
r
s
v
Typedefs
Enumerations
Enumerator
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
motioncore
primitives
random
rng.h
Go to the documentation of this file.
1
// MIT License
2
//
3
// Copyright (c) 2019 Lennart Braun
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
23
#pragma once
24
25
#include <cstddef>
26
27
namespace
encrypto::motion
{
28
29
// abstract base class for a random number generator
30
class
Rng
{
31
public
:
32
Rng
() =
default
;
33
virtual
~Rng
() =
default
;
34
35
// (re)initialize the PRG with a randomly chosen key
36
virtual
void
SampleKey
() = 0;
37
38
// fill the output buffer with number_of_bytes random bytes
39
virtual
void
RandomBytes
(std::byte* output, std::size_t number_of_bytes) = 0;
40
41
// fill the output buffer with number_of_blocks random blocks of size kBlockSize
42
virtual
void
RandomBlocks
(std::byte* output, std::size_t number_of_blocks) = 0;
43
44
// fill the output buffer with number_of_blocks random blocks of size kBlockSize
45
// where the buffer needs to be aligned at a multiple of kBlockSize
46
virtual
void
RandomBlocksAligned
(std::byte* output, std::size_t number_of_blocks) = 0;
47
static
constexpr std::size_t
kBlockSize
= 16;
48
};
49
50
}
// namespace encrypto::motion
encrypto::motion::Rng::RandomBlocks
virtual void RandomBlocks(std::byte *output, std::size_t number_of_blocks)=0
encrypto::motion::Rng::Rng
Rng()=default
encrypto::motion::Rng::SampleKey
virtual void SampleKey()=0
encrypto::motion::Rng::~Rng
virtual ~Rng()=default
encrypto::motion
Definition:
algorithm_description.cpp:35
encrypto::motion::Rng::RandomBytes
virtual void RandomBytes(std::byte *output, std::size_t number_of_bytes)=0
encrypto::motion::Rng
Definition:
rng.h:30
encrypto::motion::Rng::kBlockSize
static constexpr std::size_t kBlockSize
Definition:
rng.h:47
encrypto::motion::Rng::RandomBlocksAligned
virtual void RandomBlocksAligned(std::byte *output, std::size_t number_of_blocks)=0
Generated by
1.8.17