what do you think about this algo implementation ? + and - ?
uint256 CBlockHeader::GetArgon2idPoWHash() const
{
uint256 hash;
uint256 hash2;
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << *this;
// Hashing the data using SHA-512 (two rounds)
std::vector<unsigned char> salt_sha512(CSHA512::OUTPUT_SIZE);
CSHA512().Write((unsigned char*)&ss[0], ss.size()).Finalize(salt_sha512.data());
CSHA512().Write(salt_sha512.data(), salt_sha512.size()).Finalize(salt_sha512.data());
// Preparing data for hashing
const void* pwd = &ss[0];
size_t pwdlen = ss.size();
const void* salt = salt_sha512.data();
size_t saltlen = salt_sha512.size();
// Calling the argon2id_hash_raw function for the first round
int rc = argon2id_hash_raw(2, 262144, 4, pwd, pwdlen, salt, saltlen, &hash, 32);
if (rc != ARGON2_OK) {
printf("Error: Failed to compute Argon2id hash\n");
exit(1);
}
// Hashing the result of the first round using SHA-512 (two rounds)
std::vector<unsigned char> salt_sha512_round2(CSHA512::OUTPUT_SIZE);
CSHA512().Write((unsigned char*)&hash, 32).Finalize(salt_sha512_round2.data());
CSHA512().Write(salt_sha512_round2.data(), salt_sha512_round2.size()).Finalize(salt_sha512_round2.data());
// Calling the argon2id_hash_raw function for the second round
rc = argon2id_hash_raw(2, 524288, 4, &hash, 32, salt_sha512_round2.data(), salt_sha512_round2.size(), &hash2, 32);
if (rc != ARGON2_OK) {
printf("Error: Failed to compute Argon2id hash for the second round\n");
exit(1);
}
return hash2;
}