diff --git a/hash/argon2/argon2.cpp b/hash/argon2/argon2.cpp index a8db61a..660a822 100755 --- a/hash/argon2/argon2.cpp +++ b/hash/argon2/argon2.cpp @@ -19,7 +19,7 @@ argon2::argon2(argon2_blocks_filler_ptr filler, void *seed_memory, void *user_da __user_data = user_data; } -vector argon2::generate_hashes(const argon2profile &profile, const string &base, string &salt_) { +vector argon2::generate_hashes(const argon2profile &profile, const string &base, string salt_) { vector result; vector salts; @@ -27,13 +27,10 @@ vector argon2::generate_hashes(const argon2profile &profile, const strin uint8_t raw_hash[ARGON2_RAW_LENGTH]; for(int i=0;i<__threads;i++) { - string salt; + string salt = salt_; - if(salt_.empty()) { - salt = salt_ = __make_salt(); - } - else { - salt = salt_; + if(salt.empty()) { + salt = __make_salt(); } salts.push_back(salt); diff --git a/hash/argon2/argon2.h b/hash/argon2/argon2.h index 6d801a3..fcea476 100644 --- a/hash/argon2/argon2.h +++ b/hash/argon2/argon2.h @@ -13,7 +13,7 @@ class argon2 { public: argon2(argon2_blocks_filler_ptr filler, void *seed_memory, void *user_data); - vector generate_hashes(const argon2profile &profile, const string &base, string &salt_); + vector generate_hashes(const argon2profile &profile, const string &base, string salt_); void set_seed_memory(uint8_t *memory); void set_seed_memory_offset(size_t offset);