I have an implementation of scrypt that doesn’t produce the same output as an online scrypt key generator I found. For example, if I run my own scrypt in a function like this:
void test_scrypt(void)
{
char passwdTxt[] = "abc";
int passwdlen = strlen(passwdTxt);
uint8_t passwd[passwdlen];
memcpy(passwd, passwdTxt, passwdlen);
uint8_t salt[] = {0x5C,0x57,0xD8,0x6B,0x73,0x5E,0x98,0xD5,0x1A,0xA5,0x34,0x16,0xE2,0x90,0x29,0xAF};
int saltlen = 16;
int buflen = 32;
uint8_t buf[buflen];
int N = 16384;
int r = 8;
int p = 1;
crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen);
int i;
printf("Key:\n\r");
for (i = 0; i < buflen; ++i)
printf("%02x ", buf[i]);
}
It produces the following output:
Key:
d6 2b 0e 12 75 e3 0a 85 ce 22 03 43 ef 7e e6 d2 97 77 e1 5c 3e 35 03 63 0b fc 54 7b 8f 18 ef 63
However, when I run the same input at the site https://gchq.github.io/CyberChef/?op=Scrypt
I get the following result (note the 'output' section has a different hash from mine):
Does anyone here have their own Scrypt generator they could run this input condition on, and tell me if my output is correct or not?
I was thinking that maybe my salt is not quite valid, like perhaps I should be only using 1-128 bit (non-extended ASCII) values per byte?