22#include "model/pincode.h"
32 std::linear_congruential_engine<
unsigned long long, 48271, 0,
36 unsigned long long compat_val = engine();
38 snprintf(buffer,
sizeof(buffer) - 1,
"%0llX", compat_val);
39 return std::string(buffer);
44 return Pincode(std::min(rand() % 10000 + 1, 9999));
51 ss << std::setw(4) << std::setfill(
'0') << m_value;
56 std::string hash_hex_str;
57 picosha2::hash256_hex_string(
ToString(), hash_hex_str);
58 return hash_hex_str.substr(0, 12);
A random generated int value with accessors for string and hashcode.
static std::string IntToHash(uint64_t value)
convert numeric value to hash string.
static Pincode Create()
Create a new pincode based on a random value.
std::string Hash() const
Return a hashvalue string.
std::string ToString() const
Return value as string.
uint64_t Get() const
Return numeric value:
std::string CompatHash()
Return a hashvalue as computed on 5.8 hosts.