OpenCPN Partial API docs
Loading...
Searching...
No Matches
pincode.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2023 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#ifndef OPENCPN_INCLUDE_PINCODE_H_
25#define OPENCPN_INCLUDE_PINCODE_H_
26
27#include <string>
28#include <cstdint>
29
31class Pincode {
32public:
34 static Pincode Create();
35
37 Pincode(uint64_t v) { m_value = v; }
38
40 uint64_t Get() const;
41
43 std::string ToString() const;
44
46 std::string Hash() const;
47
49 std::string CompatHash();
50
52 static std::string IntToHash(uint64_t value);
53
54private:
55 uint64_t m_value;
56};
57
58#endif // OPENCPN_INCLUDE_PINCODE_H_
A random generated int value with accessors for string and hashcode.
Definition pincode.h:31
Pincode(uint64_t v)
Create a new pincode based on a known value.
Definition pincode.h:37
static std::string IntToHash(uint64_t value)
convert numeric value to hash string.
Definition pincode.cpp:63
static Pincode Create()
Create a new pincode based on a random value.
Definition pincode.cpp:44
std::string Hash() const
Return a hashvalue string.
Definition pincode.cpp:57
std::string ToString() const
Return value as string.
Definition pincode.cpp:51
uint64_t Get() const
Return numeric value:
Definition pincode.cpp:49
std::string CompatHash()
Return a hashvalue as computed on 5.8 hosts.
Definition pincode.cpp:33