TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An simple AES-based random number generator

13 pointsby thursdaybabout 10 years ago

4 comments

jandrewrogersabout 10 years ago
Using the AES-NI instructions seems like it should be more commonly used when you first think of it but the devil is in the details. I tried to use AES-NI for non-crypto hash functions and PRNG a few years ago and ultimately gave up on that approach even though it does work in principle.<p>The really short version: the AES instructions are too slow for the amount of usable randomness you get out of them. There are simple integer op sequences that exploit fast, multiple ALUs per core to consistently generate more usable randomness per clock cycle. The only &quot;extension&quot; instruction that generates efficient randomness per clock is the CRC instruction, though the output requires some additional processing since it is not intended to appear random.<p>That said, most popular hash functions can be greatly improved. For my own work I use a family of hash functions I invented a few years ago (really need to put these on github) that are 30-80% faster than Google&#x27;s equivalent CityHash while having levels of robust randomness that look cryptographic when tested by SMHasher and similar test suites. My first attempts were actually based on AES, which is a cool way to do it and very efficient if you can make it work, but I could not get the required performance.<p>Though now that I am thinking about it again, I may have an idea on how to maybe fix the performance problem...
评论 #9457261 未加载
scaramangaabout 10 years ago
Turns out that only clmul is needed to produce fast hash functions, even strongly universal ones.<p><a href="http:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1202.4961" rel="nofollow">http:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1202.4961</a>
swordswinger12about 10 years ago
Is Go&#x27;s AES-based hash function supposed to be a cryptographic hash? If so, did they use a standard transform (e.g. Davies-Meyer) for this task or roll their own?
yshalabiabout 10 years ago
Why not use SHA-3 for hashing? I thought it can also use AES-NI extensions?