Ethereum
PoC-8
The C++ Implementation of Ethereum
TrieHash.h
Go to the documentation of this file.
1
/*
2
This file is part of cpp-ethereum.
3
4
cpp-ethereum is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
cpp-ethereum is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16
*/
22
#pragma once
23
24
#include <
libdevcore/FixedHash.h
>
25
26
#include <vector>
27
28
namespace
dev
29
{
30
31
bytes
rlp256
(
BytesMap
const
& _s);
32
h256
hash256
(
BytesMap
const
& _s);
33
34
h256
orderedTrieRoot
(std::vector<bytes>
const
& _data);
35
36
template
<
class
T,
class
U>
inline
h256
trieRootOver
(
unsigned
_itemCount, T
const
& _getKey, U
const
& _getValue)
37
{
38
BytesMap
m;
39
for
(
unsigned
i = 0; i < _itemCount; ++i)
40
m[_getKey(i)] = _getValue(i);
41
return
hash256
(m);
42
}
43
44
h256
orderedTrieRoot
(std::vector<bytesConstRef>
const
& _data);
45
h256
orderedTrieRoot
(std::vector<bytes>
const
& _data);
46
47
}
dev::BytesMap
std::map< bytes, bytes > BytesMap
Definition:
Common.h:134
dev::trieRootOver
h256 trieRootOver(unsigned _itemCount, T const &_getKey, U const &_getValue)
Definition:
TrieHash.h:36
FixedHash.h
dev::h256
FixedHash< 32 > h256
Definition:
FixedHash.h:356
dev::orderedTrieRoot
h256 orderedTrieRoot(std::vector< bytes > const &_data)
Definition:
TrieHash.cpp:112
dev::FixedHash< 32 >
dev::rlp256
bytes rlp256(BytesMap const &_s)
Definition:
TrieHash.cpp:94
dev::hash256
h256 hash256(BytesMap const &_s)
Definition:
TrieHash.cpp:107
dev::bytes
std::vector< byte > bytes
Definition:
Common.h:72
dev
Definition:
Address.cpp:21
libdevcore
TrieHash.h
Generated on Fri Sep 20 2019 00:00:00 for Ethereum by
1.8.18