4

The Cryptonight description by the CryptoNote team states that

The 8byte_mul function, however, uses only the first 8 bytes of each argument, which are interpreted as unsigned 64-bit little-endian integers and multiplied together. The result is converted into 16 bytes, and finally the two 8-byte halves of the result are swapped.

I can't understand why this multiplication is computed this way. Why the protocol needs to run an 8 byte multiplication? Is it a hardware optimisation or is it something else I don't understand?

1 Answer 1

4

Choices made date back to the original goal of having a hash function that favored modern CPUs (vs GPU/ASIC/FPGAs). Requiring a scratchpad of 2MB fits nicely into a modern CPU L3 cache and thus the required read and writes from that cache are fast. The choice for the 64 bit multiply is again that the operation is fast on modern CPUs.

Of course, history has shown us that todays GPUs can work comfortably with the hashing algorithm, and with enough effort (and money) even ASICs can be built to run as fast or faster - hence the recent tweaks to the algorithm which again, chose operations that are fast/easy on CPUs but harder to (re)implement in ASICs.

3
  • Why it is faster? Is it just because of the registers' size of modern CPUs? Or something more complicated? Moreover, the most significant amount of time is spent in cache-misses, not computations. Does it really make any difference in practice? Nov 8, 2018 at 10:25
  • As far I understand isn't the scratchpad that prevents an ASIC implementation ? I can't see how the multiplication plays a role to prevent an ASIC ?
    – Laxmana
    Nov 8, 2018 at 10:48
  • Both play roles in ASIC resistance as they exploited two elements that favored CPUs, on chip memory cache and fast 64 bit multiply instructions. As pointed out though, ASIC manufacturer(s) can now produce chips that overcome these obstacles, therefore tweaks to the algorithm are now required to exploit the time to market for ASIC production.
    – jtgrassie
    Nov 8, 2018 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.