Question

I am trying to get my head around the scrypt algorithm output.

On https://litecoin.info/Block_hashing_algorithm the author gets the scrypt encryption result for the headerString:

01000000ae178934851bfa0e83ccb6a3fc4bfddff3641e104b6c4680c31509074e699be2bd672d8 d2199ef37a59678f92443083e3b85edef8b45c71759371f823bab59a97126614f44d5001d45920180 [little endian]

to

000000003b4ba52ab765631e20a04b88cd27f0b66d3509fb2da7781fae6d7901. [big endian]

I'm trying to replicate this but im not able to reproduce that result. I'm using an implementation that gives the correct output for the test vectors in the end of this paper: http://www.tarsnap.com/scrypt/scrypt.pdf but when running the headerString through it with the correct settings for N,r,p(1024,1,1) i get the result

c17fcd0c6d698828112ade740d4e8ad76705764da3abfc49ff3bb1863cd16472. [big endian]

I have tried it with the same result those implementations with the same result from both:

data = "01000000ae178934851bfa0e83ccb6a3fc4bfddff3641e104b6c4680c31509074e699be2bd672d8 d2199ef37a59678f92443083e3b85edef8b45c71759371f823bab59a97126614f44d5001d45920180";

    https://github.com/cheongwy/node-scrypt-js
var result = scrypt(data,data, 1024,1,1,32);

    https://github.com/tonyg/js-scrypt
var result = scrypt.crypto_scrypt(scrypt.encode_utf8(data), scrypt.encode_utf8(data), 1024, 1, 1, 32);

Im after the scrypt call im just parsing the byte array to a hex string if needed

Am I missing something here? I just can't understand why I am not getting the same result when I have validated my scrypt implementation against the paper about it.

I really need help solving this! If i haven't provided enought information please ask and ill try my best to clear things out.

Was it helpful?

Solution

you input your data as a char array while it should be interpreted as a number (in hexadecimal representation).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top