diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-02-17 16:29:21 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:47 +0100 |
commit | 5650e48b114529075d89dbdde0330901351b8460 (patch) | |
tree | c07b6715adaa10bafd76841ef1226a3659ca7d9d /include/misc.h | |
parent | 4e26fdee0c1435016d6642cf8c1f88c3dd5495fa (diff) | |
download | libnitrokey-5650e48b114529075d89dbdde0330901351b8460.tar.gz libnitrokey-5650e48b114529075d89dbdde0330901351b8460.tar.bz2 |
Get proper card serial for Storage. Get serial as one number.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/misc.h')
-rw-r--r-- | include/misc.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/misc.h b/include/misc.h index 330654a..c39c741 100644 --- a/include/misc.h +++ b/include/misc.h @@ -6,10 +6,21 @@ #include <string.h> #include "log.h" #include "LibraryException.h" +#include <sstream> +#include <iomanip> + namespace nitrokey { namespace misc { + template<typename T> + std::string toHex(T value){ + using namespace std; + std::ostringstream oss; + oss << std::hex << std::setw(sizeof(value)*2) << std::setfill('0') << value; + return oss.str(); + } + template <typename T> void strcpyT(T& dest, const char* src){ |