Skip to content

espadrine/shishua

Repository files navigation

SHISHUA – The Fastest PRNG In The World

The announcement and explanation blog post is here.

Note: please do not use this for cryptographic purposes. If you need security, a recommended option is ChaCha20.

Implementations:

Comparison

Name Intel Performance ARM Performance Quality Seed correlation
SHISHUA 52.93 GB/s 8.78 GB/s >32 TiB >32 TiB
xoshiro256+x8 40.18 GB/s 3.69 GB/s 1 KiB 0 KiB
RomuTrio 8.62 GB/s 4.76 GB/s >32 TiB 1 KiB
xoshiro256+ 7.88 GB/s 4.31 GB/s 512 MiB 1 KiB
wyrand 7.00 GB/s 2.53 GB/s >32 TiB 32 KiB
Lehmer128 6.14 GB/s 1.83 GB/s >32 TiB 1 KiB
ChaCha8 6.28 GB/s 1.72 GB/s >32 TiB? >32 TiB?
RC4 0.35 GB/s 0.15 GB/s 1 TiB 1 KiB
  1. Performance: in number of CPU cycles spent per byte generated, on N2 GCP instances. On N2D (AMD), the order is the same.
  2. Quality: level at which it fails PractRand. We show a > if it did not fail. We put a question mark if we have not proved it.
  3. Seed correlation: PractRand on interleaving of bytes from eight streams with seeds 1, 2, 4, 8, 16, 32, 64, 128. We use PractRand with folding 2 and expanded tests.

On the subject of seed correlations, the ./bin/sample-seed-fingerprints.sh program highlights additional anomalies:

  • RC4 has weak seeds with heavy artefacts visible in the fingerprints.
  • RomuTrio's fingerprints start with the same first character for all seeds.

Commands

  • make: build ./shishua.
  • make test: run performance tests, PractRand, and BigCrush on SHISHUA.
  • make test/benchmark-seed: run seed correlation test.
  • make test/benchmark-perf: run performance comparison locally.
  • make benchmark-intel: run performance comparison on a GCP Intel chip.
  • make benchmark-amd: run performance comparison on a GCP AMD chip.
  • make benchmark-arm: run performance comparison on an AWS Graviton ARM chip.

The SHISHUA and SHISHUA-half are under the CC0 license.