Bitcoin Forum
May 26, 2018, 02:14:38 PM *
News: Latest stable version of Bitcoin Core: 0.16.0  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Best choice of hashcash function today  (Read 469 times)
weex
Legendary
*
Offline Offline

Activity: 1104
Merit: 1000


Give me your tired, your poor, your huddled...


View Profile
January 21, 2016, 02:27:51 AM
 #1

I want to make it reasonably hard to spam a new network that will operate via signed documents. I'm thinking of including a nonce in the document and setting a difficulty target but my question is, what hash function would you choose today for an anti-spam application. I'd like to target it at about 10-20 seconds of hashing on a modern laptop or desktop but it would suck to hear that some ASIC can do it in 1 sec or 10ms. Thoughts?

1527344078
Hero Member
*
Offline Offline

Posts: 1527344078

View Profile Personal Message (Offline)

Ignore
1527344078
Reply with quote  #2

1527344078
Report to moderator
The block chain is the main innovation of Bitcoin. It is the first distributed timestamping system.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
achow101
Staff
Legendary
*
Offline Offline

Activity: 1414
Merit: 1329


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
January 21, 2016, 02:42:13 AM
 #2

This is the same dilemma altcoin devs have with choosing good ASIC-resistant hash algos  Cheesy

You could use just SHA256 (not SHA256d which is used in Bitcoin mining ASICs) but it is a relatively fast function so it may not be applicable. Set the difficulty high enough and it could work.

Or you can use other slower algorithms like whirlpool. Or you can use memory intensive algorithms like scrypt (but not scrypt since scrypt ASICs exist). Those options will make ASICs harder to work so they are more ASIC resistant than SHA2 algorithms.

weex
Legendary
*
Offline Offline

Activity: 1104
Merit: 1000


Give me your tired, your poor, your huddled...


View Profile
January 21, 2016, 09:07:43 AM
 #3

Played around with scrypt a little bit. Only changed the 16384 default to 32768 but I'm not sure if that's enough of a change from what scrypt ASICs do to be effective. In any case, ran this with the 0x04ffff.... target to get

Code:
import scrypt
import time
from bitcoin.core import x, b2x

start = time.time()
count = 1
if __name__ == '__main__':
    h1 = scrypt.hash(str(time.time()), 'random salt', 32768, 8, 1, 16)
    while 1:
        h1 = scrypt.hash(h1, 'random salt', 32768, 8, 1, 16)
        count += 1
        if h1 < x('04ffffffffffffffffffffffffffffff'):
            print(b2x(h1), time.time() - start, count)

Code:
$ python dochashcash.py
('0054d812ff175cbe77652ecbf2a9bb89', 2.9400529861450195, 29)
('001a28b31c37f50dc28ff98c98823cdf', 8.692596912384033, 85)
('0413606381ecb582ef1557484d8e00fc', 9.584491968154907, 94)
('00859f4ed4cd3f3e741a8662e6286cc1', 16.008608102798462, 156)
('03834f8386fd6d84ed1f28f3e509e2d1', 19.082252979278564, 187)
('011061508daa0a82c6484090142ef9de', 20.083352088928223, 197)
('01617152783622a3b8fa0f2098344d6a', 28.243431091308594, 275)
('018c126d001906ddeaaf3af9622947b8', 75.0232720375061, 728)

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!