Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sip RNG #10

Closed
dhardy opened this issue Aug 23, 2018 · 1 comment
Closed

Sip RNG #10

dhardy opened this issue Aug 23, 2018 · 1 comment

Comments

@dhardy
Copy link

dhardy commented Aug 23, 2018

I have implemented a psuedo-random number generator based on SipHash, and hope I might be able to get some feedback on the design?

This PRNG construction appears to be statistically high-quality, though only with moderate speed, and I don't know about cryptographic strength.

The motivation to doing this is to provide a "universal PRNG seeder", meaning:

  • any input can be deterministically transformed into a key of any required size
  • the output key has a high chance of avoiding low hamming-weight values even for naive input
  • for similar input values, there is a high chance that the output keys are very different

This is not intended for use in cryptography, but only for deterministic PRNGs used in simulations.


The choice of how many rounds to use, and where, is arbitrary, but designed to be similar to the standard 2-4 selection used by SipHash.

The additional tweaks to state between these rounds are entirely arbitrary choices other than being some extra tweak.

A quick guide to the source code:

  • 39, 57, 69: hasher state
  • 51, 69: RNG state
  • 320: SipHash::write function
  • 216: SipHash for short input
  • 361: SipHash::finish function for standard output
  • 242: conversion from SipHash to SipRng
  • 146: SipRng::next_u64 function
  • 410: c_rounds / d_rounds functions
  • 440, 462: test vectors
@veorq
Copy link
Owner

veorq commented Jan 11, 2021

This is not the right place for such review work.

@veorq veorq closed this as completed Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants