Hacker GitHub

← All repos

dragontamer/AESRand

View on GitHub ↗ ★ 62 C++

Random Number Generator based on hardware-accelerated AES instructions

9 mentions on Hacker News by 1 person: 1 story, 8 comments · first 2018-11-07 · latest 2025-07-24

Mentions per year 9 mentions · busiest year 2019 (2)
20082026
  1. As far as fast RNGs available, Imma just plug an old, incomplete, weekend project for ya.... https://github.com/dragontamer/AESRand Especially because you are already in the AVX domain, a fast AVX RNG that uses like 3 registers should be…
  2. Imma just leave this here... https://github.com/dragontamer/AESRand/blob/master/AESRand_L... Algorithm: void AESRand_increment(__m128i& state){ state += increment; } std::array<__m128i, 2> AESRand_rand(const __m128i state){ __m128i…
    comment by dragontamer · 2022-08-05 · in Plan B for UUIDs: double AES-128
  3. …integer->float conversion with some smart AND / OR instructions. (See the "toFloats" routine here: https://github.com/dragontamer/AESRand/blob/master/AESRand_P... ) Oh right, and you can also use the AES circuits to make random numbers,…
    comment by dragontamer · 2021-12-10 · in Better, cheaper, more abundant random numbers
  4. Cool stuff! I'll give it a lookover later. A few years ago, I wrote AESRAND ( https://github.com/dragontamer/AESRand ). I managed to get some well-known programmers to look into it, and their advice helped me write some pretty neat…
    comment by dragontamer · 2021-03-08 · in MIPS Becomes RISC-V
  5. …I just happen to have studied the AES instructions to a ridiculous degree a few years ago... ( https://github.com/dragontamer/AESRand ) You don't come up with 32-bytes of random numbers every 4-clock ticks unless you understand this stuff.…
  6. …a pretty fast generator myself. The coding was done in a weekend, but it took some weeks to test: https://github.com/dragontamer/AESRand For AESRand: "counterFunction" is a SIMD 2x64-bit Add over the XMM register. I chose an odd number…
    comment by dragontamer · 2020-10-15 · in A Family of Better Random Number Generators
  7. https://github.com/dragontamer/AESRand Yes, it is possible but its difficult to do it right. I ran into at least 3 or 4 "roadblocks" while designing this algorithm, fortunately I managed to get through all of them. I've got an unrolled…
    comment by dragontamer · 2019-10-18 · in Really Fixing Getrandom()
  8. …have a Skylake-X machine to test this idea with. See here for my experiment on AES functionality: https://github.com/dragontamer/AESRand
    comment by dragontamer · 2019-03-16 · in XXH3 – a new speed-optimized hash algorithm
  9. ▲ 3
    AESRand: SIMD code to create 32-bytes of random numbers every 3.7 cycles
    story by dragontamer · 2018-11-07 · 1 comment