OpenCPN Partial API docs
pincode.h
1 
2  /***************************************************************************
3  * Copyright (C) 2023 Alec Leamas *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  **************************************************************************/
20 #ifndef OPENCPN_INCLUDE_PINCODE_H_
21 #define OPENCPN_INCLUDE_PINCODE_H_
22 
23 #include <string>
24 #include <cstdint>
25 
27 class Pincode {
28 public:
30  static Pincode Create();
31 
33  Pincode(uint64_t v) { m_value = v; }
34 
36  uint64_t Get() const;
37 
39  std::string ToString() const;
40 
42  std::string Hash() const;
43 
45  std::string CompatHash();
46 
48  static std::string IntToHash(uint64_t value);
49 
50 private:
51  uint64_t m_value;
52 
53 };
54 
55 #endif // OPENCPN_INCLUDE_PINCODE_H_
A random generated int value with accessors for string and hashcode.
Definition: pincode.h:27
Pincode(uint64_t v)
Create a new pincode based on a known value.
Definition: pincode.h:33
static std::string IntToHash(uint64_t value)
convert numeric value to hash string.
Definition: pincode.cpp:60
static Pincode Create()
Create a new pincode based on a random value.
Definition: pincode.cpp:41
std::string Hash() const
Return a hashvalue string.
Definition: pincode.cpp:54
std::string ToString() const
Return value as string.
Definition: pincode.cpp:48
uint64_t Get() const
Return numeric value:
Definition: pincode.cpp:46
std::string CompatHash()
Return a hashvalue as computed on 5.8 hosts.
Definition: pincode.cpp:31