Coverage Report

Created: 2025-09-04 07:34

/src/solidity/libsolutil/SwarmHash.h
Line
Count
Source
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 SwarmHash.h
19
 */
20
21
#pragma once
22
23
#include <libsolutil/FixedHash.h>
24
25
#include <string>
26
27
namespace solidity::util
28
{
29
30
/// Compute the "swarm hash" of @a _input (OLD 0x1000-section version)
31
h256 bzzr0Hash(std::string const& _input);
32
33
/// Compute the "bzz hash" of @a _input (the NEW binary / BMT version)
34
h256 bzzr1Hash(bytes const& _input);
35
36
inline h256 bzzr1Hash(std::string const& _input)
37
14.6k
{
38
14.6k
  return bzzr1Hash(asBytes(_input));
39
14.6k
}
40
41
}