Bitcoin Forum
February 21, 2018, 04:28:57 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   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?

1519187337
Hero Member
*
Offline Offline

Posts: 1519187337

View Profile Personal Message (Offline)

Ignore
1519187337
Reply with quote  #2

1519187337
Report to moderator
1519187337
Hero Member
*
Offline Offline

Posts: 1519187337

View Profile Personal Message (Offline)

Ignore
1519187337
Reply with quote  #2

1519187337
Report to moderator
1519187337
Hero Member
*
Offline Offline

Posts: 1519187337

View Profile Personal Message (Offline)

Ignore
1519187337
Reply with quote  #2

1519187337
Report to moderator
Automated Bitcoin Fork Extraction Tool WE DO TOUGH WALLETS: BCH | BTG | BCD | SBTC | UBTC | B2X | BCX | BTF Electrum 2FA, Trezor, Ledger, SegWit, Bech32
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1519187337
Hero Member
*
Offline Offline

Posts: 1519187337

View Profile Personal Message (Offline)

Ignore
1519187337
Reply with quote  #2

1519187337
Report to moderator
1519187337
Hero Member
*
Offline Offline

Posts: 1519187337

View Profile Personal Message (Offline)

Ignore
1519187337
Reply with quote  #2

1519187337
Report to moderator
achow101
Staff
Legendary
*
Offline Offline

Activity: 1316
Merit: 1149


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.

.
▀ ▀ ▀▀▀
                 ▄█▄
         ▄▄      ███
         ▀██▄    ███
      ▄▄▄▄▄███▄  ███
   ▄███████████▀ ███
 ▄███▀    ▄██▀   ███
▄███     ██▀     ███
███              ███
███              ███
███▄            ▄███
 ███▄          ▄███
  ▀███▄▄▄▄▄▄▄▄███▀
    ▀▀████████▀


          ██                            ██               ▄▄
          ██                            ██               ▀▀
          ██                            ██     ▄▄
  ▄██████▄██    ▄██████▄      ▄██████▄  ██   ▄██▀        ██    ▄██████▄
▄██▀    ▀███  ▄██▀    ▀██▄  ▄██▀    ▀▀  ██ ▄██▀          ██  ▄██▀    ▀██▄
██        ██  ██        ██  ██          █████▄           ██  ██        ██
██        ██  ██        ██  ██          ██▀▀██▄          ██  ██        ██
▀██▄    ▄██▀  ▀██▄    ▄██▀  ▀██▄    ▄▄  ██   ▀██▄   ▄▄▄  ██  ▀██▄    ▄██▀
  ▀██████▀      ▀██████▀      ▀██████▀  ██     ▀██  ███  ██    ▀██████▀

▬▬   WHITEPAPER   ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
..........FACEBOOK        TWITTER        TELEGRAM..........
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬   ANN THREAD   ▬▬
.

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!