Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
Cryptography/Format.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#include "Stroika/Foundation/StroikaPreComp.h"
5
6#include <cstdio>
7
10
11#include "Format.h"
12
13using namespace Stroika::Foundation;
14
15string Cryptography::Private_::mkArrayFmt_ (const uint8_t* start, const uint8_t* end)
16{
17 return Encoding::Algorithm::Hex::Encode (as_bytes (span{start, end}));
18}
19
20string Cryptography::Private_::mkFmt_ (unsigned int n)
21{
22 char b[1024];
23 b[0] = '\0';
24 ::snprintf (b, size (b), "0x%u", n);
25 return b;
26}
27
28string Cryptography::Private_::mkFmt_ (unsigned long n)
29{
30 char b[1024];
31 b[0] = '\0';
32 ::snprintf (b, size (b), "0x%lu", n);
33 return b;
34}
35
36string Cryptography::Private_::mkFmt_ (unsigned long long n)
37{
38 char b[1024];
39 b[0] = '\0';
40 ::snprintf (b, size (b), "0x%llu", n);
41 return b;
42}