A high-performance C++ implementation of the Cap.js solver.
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2019+)
- CMake 3.15+
- pthread support
git clone https://github.com/LxHTT/Capjs-Solver-Cpp.git
mkdir build && cd build
cmake ..
make -j$(nproc)
# Default build (shared libs, examples, tests)
cmake ..
# Static library only
cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF ..
# Debug build
cmake -DCMAKE_BUILD_TYPE=Debug ..
# Release build with optimizations
cmake -DCMAKE_BUILD_TYPE=Release ..
make # Build all enabled targets
make solver # Main solver executable
make examples # Build all examples
make tests # Build all tests
#include "challenge_solver.h"
cap::SolveConfig config;
config.c = 5; // 5 challenges
config.s = 16; // 16-byte salt
config.d = 3; // difficulty 3
auto solutions = cap::ChallengeSolver::solve("token", config);
#include "cap_c_api.h"
uint64_t nonce = cap_solve_pow("salt", "00");
uint64_t results[3];
cap_solve_challenges("token", 3, 16, 3, results);
from examples.python_api.python_api_example import CapSolver
solver = CapSolver()
nonce = solver.solve_pow("salt", "00")
# Build C# examples
cd examples/csharp_api
dotnet build CsharpApiExample.csproj
dotnet run
After installation, link against the library:
# Static library
g++ -lcap_solver -pthread my_app.cpp
# Shared library
g++ -lcap_solver my_app.cpp
All tools use minimal output format:
nonce: 12345
- Single challenge resultsolutions: [123, 456, 789]
- Multiple resultserror: message
- Error messages
See LICENSE file in repository root.