busofors
busofors

Reputation: 1

incorrect hash whe try repeat argon2id_hash_raw with context

Hi i try build at argoin2id function like argon2id_hash_raw

problem is i was use it before , but now i try do it with contect

original working function

rc = argon2id_hash_raw(
    2,
    4096,
    2,
    (const void*)input, (size_t)input_len,
    (const void*)salt, 32,
    (void*)hash, 32,
    0x13
);
if (rc != ARGON2_OK) {
    applog(LOG_ERR, "argon2id_hash: Argon2id rc=%d\n", rc);
    return;
}

when i try repeat it with

argon2_context context = {0};

context.out = (uint8_t *)output;
context.outlen = 32;
context.pwd = (uint8_t *)input;
context.pwdlen = input_len;
context.salt = salt;
context.saltlen = 32;
context.secret = NULL;
context.secretlen = 0;
context.ad = NULL;
context.adlen = 0;
context.flags = ARGON2_DEFAULT_FLAGS;
context.m_cost = 4096;
context.lanes = 2;
context.threads = 2;
context.t_cost = 2;
context.allocate_cbk = NULL;
context.free_cbk = NULL;
context.version = ARGON2_VERSION_13;

int rc = argon2_ctx(&context, Argon2_id);
if (rc != ARGON2_OK) {
    applog(LOG_ERR, "argon2id_hash: Argon2id rc=%d\n", rc);
    return;
}

i get incorrect hash

expect get correct hash ( i use latest available reference)

Upvotes: 0

Views: 15

Answers (0)

Related Questions