Skip to content

creosoteshadow/ncTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ncTools

A small collection of high-quality, non-cryptographic utilities in a single header.

  • Random Number Generators
    • wyrand — ultra-fast 64-bit PRNG (~13 GB/s), Excellent for high speed, single stream applications
    • RNG256 — 256-bit state PRNG, 2^256 period, Versatile jump/discard for up to 2^128 streams, ~4.2 GB/s
  • Hash Functions
    • CompactHash — ~10 GB/s 128-bit hasher, all-in-one hashing, SMHasher clean
    • CompactHash_streaming — incremental version (identical output), streaming operators.

Features

  • 100% C++, Header-only, no dependencies beyond C++17/20 intrinsics
  • Passes PractRand (multi-TB) and SMHasher (full suite)
  • Deterministic seeding resistant to poor inputs
  • Minimal code size (~few hundred LOC core)

Usage

#include "ncTools.h"
using namespace ncTools;

wyrand rng(12345);
uint64_t r = rng();

RNG256 big_rng;
double d = big_rng.uni();

auto h = CompactHash(&data[0], data.size(), 42);
auto [lo, hi] = h;

Quick Demo

#define ENABLE_NCTOOLS_DEMO
#include "ncTools.h"
#include <iostream>

int main() {
	ncTools_demo();
}

See comments in ncTools.h for full API and test results.

License:

MIT.

About

A small collection of high-quality, non-cryptographic utilities in a single header.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages