2
$\begingroup$

Let's say I'm modifying the Scrypt hash function (https://github.com/Tarsnap/scrypt/blob/master/lib/crypto/crypto_scrypt-ref.c) and that all I want to do is replace SHA256 with SHA1 in the code to make it easier to compute. (Remember that the intention of this algorithm would be to be used as PoW, not for security. Would it be a mistake to make this change?

$\endgroup$
2
  • $\begingroup$ @kelalaka Thanks for the asnwere. I belive everyone should be able to produce their own coins, PoS make the rich richer. $\endgroup$ Dec 4, 2021 at 17:06
  • $\begingroup$ @kelalaka I was going to use it, but the repo get commits every day, its not production ready i belive. ALso, post the comment as answere and i accept it :) $\endgroup$ Dec 4, 2021 at 17:33

1 Answer 1

3
$\begingroup$

Proof-Of-Work requires pre-image resistance of the hash function, not the collision resistance. Due to the BitCoin, many people wanted to revert ( revert is the slang term in terms of Cryptography, pre-image is the term) SHA-256 even with Toffoli gates ( see on crypto ).

While the collision resistance of the SHA-1 is gone forever, the pre-image resistance will be there for a long time, well the limit is the date when a Cryptographic Quantum Computer is built to run Grover's algorithm with some other major problems solved. PBKDF2 requires pre-image resistance of the hash function, not the collision.

Therefore one can use SHA-1, whether double or not. The intention of the designer of Bitcoin was slow mining.

If one wants to have a faster mining system then the obvious choice is BLAKE3 and it is length extension attack free by design. Though BLAKE3 is a parallel hash, the performance is given on a single thread on the website of the BLAKE3.

enter image description here

There are already reference implementation and some other, this means that it is ready to use. Of course, there will be some problems while porting it to everywhere.


Note by replacing SHA-256 in the Scrypt, one actually replaces PBKDF2-SHA256 to PBKDF2-BLAKE3 where PBKDF2 uses SHA-256 to initialize HMAC-SHA256. The aim of HMAC is to construct pseudo-random function families (PRFs) and this is why it is in PBKDF2. An additional speedup can be gained by running BLAKE3 with secret prefix $BLAKE3(secret\mathbin\|m)$ instead of HMAC.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.