Lines Matching refs:Hash
23 // Hash provides an abstraction for building "hash trees" from BPF
29 class Hash {
31 static const Hash kZero;
33 Hash() : digest_() {}
35 Hash(uint16_t code,
37 const Hash& jt = kZero,
38 const Hash& jf = kZero)
49 Hash(const Hash& hash) = default;
50 Hash& operator=(const Hash& rhs) = default;
52 friend bool operator==(const Hash& lhs, const Hash& rhs) {
55 friend bool operator!=(const Hash& lhs, const Hash& rhs) {
74 const Hash Hash::kZero;
76 // Sanity check that equality and inequality work on Hash as required.
78 std::vector<Hash> hashes;
81 hashes.push_back(Hash::kZero);
83 hashes.push_back(Hash(i & 1, i & 2));
86 hashes.push_back(Hash(i & 1, i & 2, Hash(i & 4, i & 8)));
90 Hash(i & 1, i & 2, Hash(i & 4, i & 8), Hash(i & 16, i & 32)));
93 for (const Hash& a : hashes) {
94 for (const Hash& b : hashes) {
121 Hash digest(code, k, Lookup(jt), Lookup(jf));
136 std::vector<Hash> prog_hashes(program.size());
139 Hash& hash = prog_hashes.at(i - 1);
146 hash = Hash(insn.code, insn.k, prog_hashes.at(i + insn.jt),
150 hash = Hash(insn.code, insn.k);
152 hash = Hash(insn.code, insn.k, prog_hashes.at(i));
160 const Hash& Lookup(CodeGen::Node next) const {
162 return Hash::kZero;
167 return Hash::kZero;
173 std::map<CodeGen::Node, Hash> node_hashes_;