16#ifndef LIEF_ELF_GNU_HASH_H
17#define LIEF_ELF_GNU_HASH_H
44 GnuHash(uint32_t symbol_idx, uint32_t shift2,
45 std::vector<uint64_t> bloom_filters, std::vector<uint32_t> buckets,
46 std::vector<uint32_t> hash_values = {});
60 return buckets_.size();
77 return bloom_filters_.size();
82 return bloom_filters_;
86 const std::vector<uint32_t>&
buckets()
const {
100 return buckets_[
hash % nb_buckets()] > 0;
107 bool check(
const std::string& symbol_name)
const;
121 uint32_t symbol_index_ = 0;
122 uint32_t shift2_ = 0;
124 std::vector<uint64_t> bloom_filters_;
125 std::vector<uint32_t> buckets_;
126 std::vector<uint32_t> hash_values_;
Class which represents an ELF binary.
Definition ELF/Binary.hpp:59
Class which takes an ELF::Binary object and reconstructs a valid binary.
Definition ELF/Builder.hpp:48
Class which provides a view over the GNU Hash implementation. Most of the fields are read-only since ...
Definition GnuHash.hpp:36
bool check_bucket(uint32_t hash) const
Check if the given hash passes the bucket filter.
Definition GnuHash.hpp:99
GnuHash(uint32_t symbol_idx, uint32_t shift2, std::vector< uint64_t > bloom_filters, std::vector< uint32_t > buckets, std::vector< uint32_t > hash_values={})
GnuHash & operator=(const GnuHash ©)=default
GnuHash & operator=(GnuHash &&)=default
bool check(uint32_t hash) const
Check if the symbol associated with the given hash probably exists. If the returned value is false yo...
uint32_t symbol_index() const
Index of the first symbol in the dynamic symbols table which accessible with the hash table.
Definition GnuHash.hpp:65
const std::vector< uint32_t > & hash_values() const
Hash values.
Definition GnuHash.hpp:91
void accept(Visitor &visitor) const override
uint32_t maskwords() const
Number of bloom filters used. It must be a power of 2.
Definition GnuHash.hpp:76
GnuHash(const GnuHash ©)=default
~GnuHash() override=default
bool check(const std::string &symbol_name) const
Check if the symbol probably exists. If the returned value is false you can assume at 100% that the s...
GnuHash(GnuHash &&)=default
uint32_t nb_buckets() const
Return the number of buckets.
Definition GnuHash.hpp:59
const std::vector< uint64_t > & bloom_filters() const
Bloom filters.
Definition GnuHash.hpp:81
bool check_bloom_filter(uint32_t hash) const
Check if the given hash passes the bloom filter.
friend std::ostream & operator<<(std::ostream &os, const GnuHash &gnuhash)
const std::vector< uint32_t > & buckets() const
Hash buckets.
Definition GnuHash.hpp:86
uint32_t shift2() const
Shift count used in the bloom filter.
Definition GnuHash.hpp:70
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:45
Definition Visitor.hpp:224
LIEF namespace.
Definition Abstract/Binary.hpp:32
Hash::value_type hash(const Object &v)
#define LIEF_API
Definition visibility.h:41