Let's open hash-function discussion friends.Just want to uncover our approach and show differences with CryptoNote that we use in our project announced here:
https://bitcointalk.org/index.php?topic=577267.0First of all I want to say that CryptoNote hash function (so called cn_slow_hash) is actually a very strong protected from ASIC's with different CPU instructions set as well as memory consuming algo. cn_slow_hash works hard on 2MB scratchpad and most of this scratchpad are fits in CPU cache.
![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fhoneypenny.org%2Ffiles%2Fcryptonote_hash.svg&t=665&c=57MGzxod3ygI9Q)
For now it is difficult imagine that will be possible to make some specific hardware which will be more effective than CPU and will coast less than CPU. But world changes so fast, nobody knows what will happen in near future. We've all seen how rapid technological breakthroughs capable of performing the computer industry.
![Huh](https://bitcointalk.org/Smileys/default/huh.gif)
Since cn_slow_hash created 2MB scratchpad, it's have to cover all this data, that's why they use 2
20 iterations, and side-effect from this pretty slow work (about 500ms on normal laptop, twice faster on normal pc with suitable cpu cache). It may slow down synchronisation process at downloading blockchain (that is not a big problem) and theoretically it may be possible to attack network - connect and send a random block to make peer calculate slow_hash for useless fake block.
So, putting all together, we want to have:
1. Wide CPU instruction set
2. Memory-oriented algo
3. Small work time.
Realizing it, we've tried to take a step to the side.
Idea of using blockchain data as scratchpad resulted in this hash function:
![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fboolberry.com%2Ffiles%2Fboolb_hash.svg&t=665&c=WgwvSBWLqJpMyw)
Actually this is a keccak hybrid, which use external scratchpad. After each keccack round, psudo-randomly addressed[state vector used as addresses] data is taken from scratchpad and xored with state.
Calculating each block PoW usualy hits about 1100 randomly addressed reading of blocks by 32 bytes.
I used "performance_tests" with different scratchpad size to find out memory hardness:
Warm up: 2161 ms
test_wild_keccak<400> - OK:
loop count: 100000
elapsed: 3020 ms
time per call: 0 ms/call
Warm up: 2158 ms
test_wild_keccak<40000> - OK:
loop count: 100000
elapsed: 3060 ms
time per call: 0 ms/call
Warm up: 2168 ms
test_wild_keccak<4000000> - OK:
loop count: 100000
elapsed: 3484 ms
time per call: 0 ms/call
Warm up: 2156 ms
test_wild_keccak<40000000> - OK:
loop count: 100000
elapsed: 8119 ms
time per call: 0 ms/call
Warm up: 2150 ms
test_wild_keccak<100000000> - OK:
loop count: 100000
elapsed: 8574 ms
time per call: 0 ms/call
As you can see, working on small amount of memory 100000 hash operations takes 3020 ms, meanwhile work on 100Mb scratchpad with the same operations count takes 8574 ms.
Such difference(caused by the cache memory overflow) points to real memory hardness we guess.
Wellcome to comment.