MCPcopy Create free account
hub / github.com/lief-project/LIEF / init_hash

Function init_hash

api/python/src/pyLIEF.cpp:167–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167void init_hash(nb::module_& m) {
168 m.def("hash", nb::overload_cast<const Object&>(&hash));
169 m.def("hash", nb::overload_cast<const std::vector<uint8_t>&>(&hash));
170 m.def("hash",
171 [] (nb::bytes bytes) {
172 const auto* begin = reinterpret_cast<const uint8_t*>(bytes.c_str());
173 const auto* end = begin + bytes.size();
174 return LIEF::hash(std::vector<uint8_t>(begin, end));
175 });
176
177 m.def("hash",
178 [] (const std::string& bytes) {
179 const std::vector<uint8_t> data = {std::begin(bytes), std::end(bytes)};
180 return hash(data);
181 });
182}
183
184
185void init_json(nb::module_& m) {

Callers 1

initFunction · 0.85

Calls 5

c_strMethod · 0.80
hashFunction · 0.50
beginFunction · 0.50
endFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected