Bitcoin Forum
May 09, 2024, 08:38:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Best choice of hashcash function today  (Read 539 times)
weex (OP)
Legendary
*
Offline Offline

Activity: 1102
Merit: 1014



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?
1715243918
Hero Member
*
Offline Offline

Posts: 1715243918

View Profile Personal Message (Offline)

Ignore
1715243918
Reply with quote  #2

1715243918
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715243918
Hero Member
*
Offline Offline

Posts: 1715243918

View Profile Personal Message (Offline)

Ignore
1715243918
Reply with quote  #2

1715243918
Report to moderator
1715243918
Hero Member
*
Offline Offline

Posts: 1715243918

View Profile Personal Message (Offline)

Ignore
1715243918
Reply with quote  #2

1715243918
Report to moderator
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6631


Just writing some code


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 (OP)
Legendary
*
Offline Offline

Activity: 1102
Merit: 1014



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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!