A high-performance C++ header-only library for string hashing with rolling hash functionality.
- Rolling string hash implementation
- Multiple hash support
- Template-based for flexibility
- Header-only library (easy to integrate)
- Support for adding/removing characters from both ends
git clone https://github.com/sushant-wayal/stringhash.git
cd stringhash
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build . --target installvcpkg install stringhashSimply copy the include folder to your project and add it to your include path.
#include <stringhash>
#include <iostream>
#include <vector>
int main() {
long long modNum = 1e9 + 7;
std::vector<long long> p = {31};
std::vector<long long> mod = {modNum};
stringHash<long long> h("abc", 0, 2, p, mod);
std::cout << h.getHash()[0] << std::endl;
return 0;
}After installation, you can use the library in your CMake project:
find_package(stringhash REQUIRED)
target_link_libraries(your_target stringhash::stringhash)MIT License - see LICENSE file for details.
A header-only C++ library for efficient string hashing.
#include <sushant-wayal/stringhash>
#include <iostream>
using namespace std;
int main() {
vector<long long> p = {31}, mod = {1e9+7};
stringHash<long long> h("abc", 0, 2, p, mod);
cout << h.getHash()[0] << endl;
}