29 lines
847 B
C++
29 lines
847 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <cstdint>
|
|
|
|
namespace scar {
|
|
|
|
class Argon2Wrapper {
|
|
public:
|
|
// Generate a random salt
|
|
static std::string generateSalt(size_t length = 16);
|
|
|
|
// Hash password with provided salt
|
|
static std::string hashPassword(const std::string& password, const std::string& salt);
|
|
|
|
// Verify password against hash
|
|
static bool verifyPassword(const std::string& password, const std::string& salt,
|
|
const std::string& hash);
|
|
|
|
private:
|
|
static constexpr uint32_t TIME_COST = 2; // Number of iterations
|
|
static constexpr uint32_t MEMORY_COST = 65536; // 64 MB
|
|
static constexpr uint32_t PARALLELISM = 4; // Number of threads
|
|
static constexpr uint32_t HASH_LENGTH = 32; // Output hash length
|
|
};
|
|
|
|
} // namespace scar
|