aboutsummaryrefslogtreecommitdiff
path: root/xsig
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-16 18:18:03 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-18 01:54:17 -0400
commit577f49b25c22a267fb3a29af5832f7ab0c2f4769 (patch)
tree02705d78d3ae5db3b6c6d6f0eda75ef08ce9954c /xsig
parent4401f681d33f534a7d7ef8f4f940bd54b60710c3 (diff)
downloaddeduper-577f49b25c22a267fb3a29af5832f7ab0c2f4769.tar.xz
Dunno why I used pascal case in the first place...
Diffstat (limited to 'xsig')
-rw-r--r--xsig/src/base64.cpp16
-rw-r--r--xsig/src/base64.hpp8
-rw-r--r--xsig/src/signature.cpp4
3 files changed, 14 insertions, 14 deletions
diff --git a/xsig/src/base64.cpp b/xsig/src/base64.cpp
index 3dae3a2..c5f6b32 100644
--- a/xsig/src/base64.cpp
+++ b/xsig/src/base64.cpp
@@ -6,11 +6,11 @@
#include "base64.hpp"
-const char *Base64Encoder::b64c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+const char *base64_encoder::b64c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-Base64Encoder::Base64Encoder() : counter(0), rem(0), ret(std::string()) {}
+base64_encoder::base64_encoder() : counter(0), rem(0), ret(std::string()) {}
-void Base64Encoder::encode_data(const void *data, size_t len)
+void base64_encoder::encode_data(const void *data, size_t len)
{
const uint8_t *u8d = (uint8_t*) data;
for (size_t i = 0; i < len; ++i)
@@ -37,7 +37,7 @@ void Base64Encoder::encode_data(const void *data, size_t len)
}
}
-std::string Base64Encoder::finalize()
+std::string base64_encoder::finalize()
{
if (counter)
{
@@ -48,7 +48,7 @@ std::string Base64Encoder::finalize()
return ret;
}
-const uint8_t Base64Decoder::b64v[] = {
+const uint8_t base64_decoder::b64v[] = {
65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,
65,65,65,65,65,65,65,65,65,65,65,62,65,65,65,63,
@@ -59,7 +59,7 @@ const uint8_t Base64Decoder::b64v[] = {
41,42,43,44,45,46,47,48,49,50,51,65,65,65,65,65
};
-Base64Decoder::Base64Decoder(std::string &&b) :
+base64_decoder::base64_decoder(std::string &&b) :
s(b),
invalid(false),
rem(0),
@@ -83,12 +83,12 @@ Base64Decoder::Base64Decoder(std::string &&b) :
}
}
-size_t Base64Decoder::decoded_length()
+size_t base64_decoder::decoded_length()
{
return dlen;
}
-size_t Base64Decoder::decode_data(const void *data, size_t len)
+size_t base64_decoder::decode_data(const void *data, size_t len)
{
uint8_t *rp = (uint8_t*)data;
for (; bp < s.size(); ++bp)
diff --git a/xsig/src/base64.hpp b/xsig/src/base64.hpp
index 70d4e40..2341ab5 100644
--- a/xsig/src/base64.hpp
+++ b/xsig/src/base64.hpp
@@ -3,7 +3,7 @@
#include <cstdint>
#include <string>
-class Base64Encoder
+class base64_encoder
{
private:
static const char *b64c;
@@ -11,12 +11,12 @@ private:
uint8_t rem;
std::string ret;
public:
- Base64Encoder();
+ base64_encoder();
void encode_data(const void *data, size_t len);
std::string finalize();
};
-class Base64Decoder
+class base64_decoder
{
private:
static const uint8_t b64v[];
@@ -27,7 +27,7 @@ private:
size_t bp;
std::string s;
public:
- Base64Decoder(std::string &&b);
+ base64_decoder(std::string &&b);
size_t decoded_length();
size_t decode_data(const void *data, size_t len);
};
diff --git a/xsig/src/signature.cpp b/xsig/src/signature.cpp
index b912198..9daf131 100644
--- a/xsig/src/signature.cpp
+++ b/xsig/src/signature.cpp
@@ -245,7 +245,7 @@ bool signature::operator==(const signature &o) const
std::string signature::to_string() const
{
if (!p || !p->compressed) return std::string();
- Base64Encoder enc;
+ base64_encoder enc;
size_t sz = p->ct.size();
enc.encode_data(&p->cfg, sizeof(signature_config));
enc.encode_data(&sz, sizeof(size_t));
@@ -256,7 +256,7 @@ std::string signature::to_string() const
signature signature::from_string(std::string &&s)
{
signature_priv *p = new signature_priv;
- Base64Decoder dec(std::move(s));
+ base64_decoder dec(std::move(s));
size_t sz;
p->compressed = true;
size_t s1 = dec.decode_data(&p->cfg, sizeof(signature_config));