/src/solidity/libsolutil/Keccak256.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | This file is part of solidity. |
3 | | |
4 | | solidity 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 | | solidity 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 solidity. If not, see <http://www.gnu.org/licenses/>. |
16 | | */ |
17 | | // SPDX-License-Identifier: GPL-3.0 |
18 | | /** @file SHA3.h |
19 | | * @author Gav Wood <i@gavwood.com> |
20 | | * @date 2014 |
21 | | * |
22 | | * The FixedHash fixed-size "hash" container type. |
23 | | */ |
24 | | |
25 | | #pragma once |
26 | | |
27 | | #include <libsolutil/FixedHash.h> |
28 | | |
29 | | #include <string> |
30 | | |
31 | | namespace solidity::util |
32 | | { |
33 | | |
34 | | /// Calculate Keccak-256 hash of the given input, returning as a 256-bit hash. |
35 | | h256 keccak256(bytesConstRef _input); |
36 | | |
37 | | /// Calculate Keccak-256 hash of the given input, returning as a 256-bit hash. |
38 | 0 | inline h256 keccak256(bytes const& _input) { return keccak256(bytesConstRef(&_input)); } |
39 | | |
40 | | /// Calculate Keccak-256 hash of the given input (presented as a binary-filled string), returning as a 256-bit hash. |
41 | 0 | inline h256 keccak256(std::string const& _input) { return keccak256(bytesConstRef(_input)); } |
42 | | |
43 | | /// Calculate Keccak-256 hash of the given input (presented as a FixedHash), returns a 256-bit hash. |
44 | | template<unsigned N> inline h256 keccak256(FixedHash<N> const& _input) { return keccak256(_input.ref()); } |
45 | | |
46 | | } |