aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/passhash
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/passhash')
-rw-r--r--src/lib/passhash/bcrypt/bcrypt.cpp8
-rw-r--r--src/lib/passhash/passhash9/passhash9.cpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/passhash/bcrypt/bcrypt.cpp b/src/lib/passhash/bcrypt/bcrypt.cpp
index 218404110..3f6a68352 100644
--- a/src/lib/passhash/bcrypt/bcrypt.cpp
+++ b/src/lib/passhash/bcrypt/bcrypt.cpp
@@ -103,13 +103,13 @@ std::string make_bcrypt(const std::string& pass,
// Include the trailing NULL byte
blowfish.eks_key_schedule(reinterpret_cast<const byte*>(pass.c_str()),
pass.length() + 1,
- &salt[0],
+ salt.data(),
work_factor);
for(size_t i = 0; i != 64; ++i)
- blowfish.encrypt_n(&ctext[0], &ctext[0], 3);
+ blowfish.encrypt_n(ctext.data(), ctext.data(), 3);
- std::string salt_b64 = bcrypt_base64_encode(&salt[0], salt.size());
+ std::string salt_b64 = bcrypt_base64_encode(salt.data(), salt.size());
std::string work_factor_str = std::to_string(work_factor);
if(work_factor_str.length() == 1)
@@ -117,7 +117,7 @@ std::string make_bcrypt(const std::string& pass,
return "$2a$" + work_factor_str +
"$" + salt_b64.substr(0, 22) +
- bcrypt_base64_encode(&ctext[0], ctext.size() - 1);
+ bcrypt_base64_encode(ctext.data(), ctext.size() - 1);
}
}
diff --git a/src/lib/passhash/passhash9/passhash9.cpp b/src/lib/passhash/passhash9/passhash9.cpp
index 3898cdb44..f30684ec6 100644
--- a/src/lib/passhash/passhash9/passhash9.cpp
+++ b/src/lib/passhash/passhash9/passhash9.cpp
@@ -56,7 +56,7 @@ std::string generate_passhash9(const std::string& pass,
PKCS5_PBKDF2 kdf(prf); // takes ownership of pointer
secure_vector<byte> salt(SALT_BYTES);
- rng.randomize(&salt[0], salt.size());
+ rng.randomize(salt.data(), salt.size());
const size_t kdf_iterations = WORK_FACTOR_SCALE * work_factor;
@@ -67,7 +67,7 @@ std::string generate_passhash9(const std::string& pass,
blob += salt;
blob += kdf.derive_key(PASSHASH9_PBKDF_OUTPUT_LEN,
pass,
- &salt[0], salt.size(),
+ salt.data(), salt.size(),
kdf_iterations).bits_of();
return MAGIC_PREFIX + base64_encode(blob);
@@ -123,7 +123,7 @@ bool check_passhash9(const std::string& pass, const std::string& hash)
&bin[ALGID_BYTES + WORKFACTOR_BYTES], SALT_BYTES,
kdf_iterations).bits_of();
- return same_mem(&cmp[0],
+ return same_mem(cmp.data(),
&bin[ALGID_BYTES + WORKFACTOR_BYTES + SALT_BYTES],
PASSHASH9_PBKDF_OUTPUT_LEN);
}