diff options
author | Jack Lloyd <[email protected]> | 2017-09-16 14:35:07 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-16 14:35:07 -0400 |
commit | 0318e673f64d8b8123b23fbf74cb3f66515037be (patch) | |
tree | 842d90c86811c50dd349dc7fa0eef6ac3ff24e2a /src | |
parent | 3d63a182e857251769dce6e8b0eb75b3b9acce03 (diff) |
Small cleanup in bcrypt
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/passhash/bcrypt/bcrypt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/passhash/bcrypt/bcrypt.cpp b/src/lib/passhash/bcrypt/bcrypt.cpp index 4f3cda2ae..73456dead 100644 --- a/src/lib/passhash/bcrypt/bcrypt.cpp +++ b/src/lib/passhash/bcrypt/bcrypt.cpp @@ -90,14 +90,12 @@ std::string make_bcrypt(const std::string& pass, const std::vector<uint8_t>& salt, uint16_t work_factor) { - auto magic = std::vector<uint8_t>{ + static const uint8_t BCRYPT_MAGIC[8*3] = { 0x4F, 0x72, 0x70, 0x68, 0x65, 0x61, 0x6E, 0x42, 0x65, 0x68, 0x6F, 0x6C, 0x64, 0x65, 0x72, 0x53, 0x63, 0x72, 0x79, 0x44, 0x6F, 0x75, 0x62, 0x74 }; - std::vector<uint8_t> ctext = magic; - Blowfish blowfish; // Include the trailing NULL byte @@ -106,6 +104,8 @@ std::string make_bcrypt(const std::string& pass, salt.data(), work_factor); + std::vector<uint8_t> ctext(BCRYPT_MAGIC, BCRYPT_MAGIC + 8*3); + for(size_t i = 0; i != 64; ++i) blowfish.encrypt_n(ctext.data(), ctext.data(), 3); |