Skip to content

JustAmnesias/justHash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

justHash

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

Features

  • 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.

Usage

Hashing Data

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;
}

Random Number Generation

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;
}

Motivation

  • I made it just because I needed something for hashing data, so if you want to use it - feel free <3

License

This project is licensed under the MIT License.

About

A simple, crt-free 64-bit hash algorithm and PRNG. I made it because I needed a lightweight tool for hashing data without dependencies :) If you need something fast and easy to drop into your project, then feel free to use it <3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages