Where can I find a description of the CryptoNight hash algorithm?
Both a thorough and ELI5 description of the hash algorithm would be appreciated
Monero Stack Exchange is a question and answer site for developers and users of the secure, private and untraceable cryptocurrency Monero. It only takes a minute to sign up.
Sign up to join this communityWhere can I find a description of the CryptoNight hash algorithm?
Both a thorough and ELI5 description of the hash algorithm would be appreciated
The description of the CryptoNight hash algorithm and the steps it performs can be found in the code as well as in a written file by the CryptoNote team, which can be found here. Lastly, in his blog, professor David Anderson also briefly describes the CryptoNight algorithm with an accompanying graph that illustrates it. From the blog:
This was a brilliantly designed proof-of-work function targeting the strengths of modern CPUs -- native AES encryption and fast 64 bit multipliers -- tuned to use a scratchpad exactly the size of the per-core L3 cache on Intel CPUs (about 2MB) that someone then wrapped in such a thick blanket of crap it was nearly unrecognizable until you started jumping in, tearing it apart, and putting it back together again.
Here's what it looks like without the crud (diagram shows one round): Some initial 128 bit values are determined by hashing the block state using a Keccak (sha3) variant - call them A and B. The big lookup table is also populated using that same state, mixed around using AES. Then, executed 500,000 times, are rounds of mixing as shown at the right: Use A to determine a pseudorandom location in the scratchpad, take that, mix it in, AES encrypt it (one round), use the result to determine a second location, use that in a 64 bit multiply, store it back, and repeat. Elegantly simple.