justHash is a lightweight, CRT-free, non-cryptographic 64-bit hash algorithm and PRNG (Pseudo-Random Number Generator) written in C++ :)
It is designed as a simple, zero-dependency tool for fast data hashing and random number generation. It can be easily dropped into any project
- CRT-Free: Zero dependencies. Does not rely on
std::hash,memcpy, or any other standard library functions. - 64-bit Optimized: Built on a robust ARX (Add-Rotate-Xor) design with XOR-Folding for superior bit diffusion.
- Irrational Constants: Uses seeds based on the Golden Ratio and Pi to ensure high entropy.
- Header-only: Simply copy the header file into your project to get started.
- PRNG Included: Comes with a fast, high-quality random generator (
justRand) based on the same hashing principles.
You can compute a hash statically without needing to instantiate an object.
#include "justHash.hpp"
#include <iostream>
int main() {
const char* data = "bybyby-bebebe";
unsigned __int64 length = 18;
unsigned __int64 h = justHash::compute(data, length);
std::cout << "Hash: 0x" << std::hex << h << std::endl;
return 0;
}Use the included justRand generator for high-quality pseudo-random numbers.
#include "justHash.hpp"
int main() {
justRand rng;
rng.seed(12345);
unsigned __int64 randomValue = rng.next();
return 0;
}- I made it just because I needed something for hashing data, so if you want to use it - feel free <3
This project is licensed under the MIT License.