summaryrefslogtreecommitdiff
path: root/include/misc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/misc.h')
-rw-r--r--include/misc.h11
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){