23 lines
640 B
C++
23 lines
640 B
C++
#ifndef UTILS_HPP
|
|
#define UTILS_HPP
|
|
#include <string>
|
|
#include <chrono>
|
|
#include <sstream>
|
|
#include <iomanip>
|
|
|
|
namespace hashing {
|
|
std::string GenerateSetting(unsigned long cost = 0);
|
|
std::string HashPassword(const std::string& password, const std::string& setting);
|
|
bool VerifyPassword(const std::string& password, const std::string& stored_password);
|
|
std::string generate_token(size_t bytes = 32);
|
|
}
|
|
|
|
namespace timestamp {
|
|
typedef std::chrono::system_clock::time_point Timestamp;
|
|
|
|
Timestamp ParseTimestamp(const std::string& ts);
|
|
Timestamp Now();
|
|
std::string FormatTimestamp(const Timestamp& ts);
|
|
}
|
|
|
|
#endif |