Bitcoin ABC  0.24.7
P2P Digital Currency
proofid.h
Go to the documentation of this file.
1 // Copyright (c) 2020 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_AVALANCHE_PROOFID_H
6 #define BITCOIN_AVALANCHE_PROOFID_H
7 
8 #include <salteduint256hasher.h>
9 #include <uint256.h>
10 
11 #include <string>
12 
13 class CPubKey;
14 
15 namespace avalanche {
16 
17 struct ProofId : public uint256 {
18  explicit ProofId() : uint256() {}
19  explicit ProofId(const uint256 &b) : uint256(b) {}
20 
21  static ProofId fromHex(const std::string &str) {
22  ProofId r;
23  r.SetHex(str);
24  return r;
25  }
26 };
27 
28 struct LimitedProofId : public uint256 {
29  explicit LimitedProofId() : uint256() {}
30  explicit LimitedProofId(const uint256 &b) : uint256(b) {}
31 
32  static LimitedProofId fromHex(const std::string &str) {
34  r.SetHex(str);
35  return r;
36  }
37 
38  ProofId computeProofId(const CPubKey &proofMaster) const;
39 };
40 
42 public:
44  size_t operator()(const ProofId &proofid) const { return hash(proofid); }
45 };
46 
47 } // namespace avalanche
48 
49 #endif // BITCOIN_AVALANCHE_PROOFID_H
SaltedUint256Hasher
Definition: salteduint256hasher.h:11
avalanche::SaltedProofIdHasher::SaltedProofIdHasher
SaltedProofIdHasher()
Definition: proofid.h:43
avalanche::SaltedProofIdHasher
Definition: proofid.h:41
avalanche
Definition: avalanche.h:11
uint256.h
avalanche::LimitedProofId::LimitedProofId
LimitedProofId()
Definition: proofid.h:29
avalanche::ProofId
Definition: proofid.h:17
avalanche::LimitedProofId::LimitedProofId
LimitedProofId(const uint256 &b)
Definition: proofid.h:30
uint256
256-bit opaque blob.
Definition: uint256.h:127
avalanche::LimitedProofId
Definition: proofid.h:28
avalanche::LimitedProofId::fromHex
static LimitedProofId fromHex(const std::string &str)
Definition: proofid.h:32
CPubKey
An encapsulated public key.
Definition: pubkey.h:31
SaltedUint256Hasher::hash
size_t hash(const uint256 &h) const
Definition: salteduint256hasher.h:19
avalanche::ProofId::ProofId
ProofId()
Definition: proofid.h:18
avalanche::ProofId::ProofId
ProofId(const uint256 &b)
Definition: proofid.h:19
avalanche::SaltedProofIdHasher::operator()
size_t operator()(const ProofId &proofid) const
Definition: proofid.h:44
avalanche::ProofId::fromHex
static ProofId fromHex(const std::string &str)
Definition: proofid.h:21
salteduint256hasher.h
avalanche::LimitedProofId::computeProofId
ProofId computeProofId(const CPubKey &proofMaster) const
Definition: proofid.cpp:12
base_blob::SetHex
void SetHex(const char *psz)
Definition: uint256.cpp:24