Additionally, if I wanted to put together my own implementation of the Monero CryptoNight PoW, specifically for mining, and was using one of those (with the corresponding tests on GitHub) to validate my implementation, which one should I use? Would it matter? I ask because after using the slow hash, it produces the correct output for the given slow hash tests but it doesn't produce the correct output for the given fast hash tests.
1 Answer
cn_slow_hash is CryptoNight. cn_fast_hash is Keccak. As the names imply, the former is much slower than the latter. Both hash a contiguous buffer. Cryptonight is used for PoW and KDF, while Keccak is used for everything else.
tree_hash is a merkle tree hasher: it works on a binary tree of hashes, and uses cn_fast_hash for the actual buffer hashing.