A sub-optimal Java native implementation of the CryptoNight proof of work algorithm, see CryptoNightJNI for an optimal solution.
The algorithms implementation can be found in: Cryptonight.java with various other hashing packages used.
The CryptoNight algorithm consists of three sections: scratchpad initialisation, memory-hard loop and results calculation. The following three diagrams (based on the Cryptonote Standard 2013) provide an overview on how the algorithm functions. See the Monero docs or JRC writeup for more info.
Scratchpad Initialisation:
Memory-hard Loop:
Results Calculation:
The project structure and dependencies can be seen in the following diagram:
- Optimisation throughout (see code)
- Refactor Cryptonight.java to implement hashing digest interface as to stay consistent with other Java hashing algorithms