edwardraff / lzjd Goto Github PK
View Code? Open in Web Editor NEWC++ implementation of LZJD algorithm
License: Apache License 2.0
C++ implementation of LZJD algorithm
License: Apache License 2.0
Modern CMake is upset with the minimum version being 2.8:
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Boost 1.74 has this warning:
In file included from /usr/include/boost/config/header_deprecated.hpp:18,
from /usr/include/boost/function_output_iterator.hpp:12,
from /home/rjzak/CLionProjects/MalwareDB/LZJD/src/LZJD.cpp:8:
/usr/include/boost/function_output_iterator.hpp:14:1: note: ‘#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.’
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
For reference, LZJD wants 1.50 or newer, Debian 12 (my system) has 1.74, the latest version is 1.82.
Hi, I read your papers and I found them really interesting. I'm eager to play with them, but I'm not a C++ developer and I'm not sure how I should compile this.
So, on my Ubuntu box, I installed cmake, libboost-dev, libboost-program-options-dev, libboost-system-dev and libboost-filesystem-dev. At this point cmake doesn't complain anymore. From the source directory I run "cmake .", and then "make", but I get the following error and the build halts:
[ 10%] Building CXX object CMakeFiles/lzjd.static.dir/LZJD.cpp.o
/home/della/pkg/LZJD/src/LZJD.cpp: In function ‘int32_t similarity(const std::vector<int>&, const std::vector<int>&)’:
/home/della/pkg/LZJD/src/LZJD.cpp:132:19: error: ‘round’ was not declared in this scope
return (int) (round(100*sim));
^~~~~
/home/della/pkg/LZJD/src/LZJD.cpp:132:19: note: suggested alternative: ‘rand’
return (int) (round(100*sim));
^~~~~
rand
Can you help me with understanding how to get a running binary? Thanks a lot!
Hello,
The implementation has a bug in the case where the strings are not long enough to generate the target hash full length.
The function:
std::vector<int32_t> getAllHashes(std::vector& bytes, uint64_t k)
stops generating the hast at the last character of the string.
The function:
std::vector<int32_t> digest(uint64_t k, std::vector& bytes)
then does a vector.resize up to the target hash size. This means padding the vector with zeros.
The set intersection function has a very strong initial assumption about the set being a real set and not a vector. If there is one single duplicate value in either of the input arrays the comparison of the hashes gives wrong results.
Here is my current solution to this problem. (Space padding the input string until the target hash size is reached using the same set insert mechanism as for the input string).
std::vector<int32_t> getAllHashes(std::vector& bytes, uint64_t k)
{
std::vector<int32_t> ints;
std::unordered_set<int32_t> x_set;
MurmurHash3 running_hash = MurmurHash3();
for(char b : bytes)
{
int32_t hash = running_hash.pushByte(b);
if (x_set.insert(hash).second)
{
//was successfully added, so never seen it before. Put it in!
ints.push_back(hash);
running_hash.reset();
}
}
while (ints.size() < k) {
int32_t hash = running_hash.pushByte(0x20);
if (x_set.insert(hash).second)
{
//was successfully added, so never seen it before. Put it in!
ints.push_back(hash);
running_hash.reset();
}
}
return ints;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.