22 #include "model/pincode.h"
32 std::linear_congruential_engine<
unsigned long long, 48271, 0,
33 0xFFFFFFFFFFFFFFFF> engine;
35 unsigned long long compat_val = engine();
37 snprintf(buffer,
sizeof(buffer)-1,
"%0llX", compat_val);
38 return std::string(buffer);
43 return Pincode(std::min(rand() % 10000 + 1, 9999));
50 ss << std::setw(4) << std::setfill(
'0') << m_value;
55 std::string hash_hex_str;
56 picosha2::hash256_hex_string(
ToString(), hash_hex_str);
57 return hash_hex_str.substr(0,12);
A random generated int value with accessors for string and hashcode.
Pincode(uint64_t v)
Create a new pincode based on a known value.
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.