s and i keys for all addresses

This commit is contained in:
orignal 2022-02-05 17:14:25 -05:00
parent 450266818a
commit 4211c733a2
6 changed files with 18 additions and 37 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2020, The PurpleI2P Project
* Copyright (c) 2013-2022, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
@ -9,14 +9,6 @@
#ifndef TAG_H__
#define TAG_H__
/*
* Copyright (c) 2013-2017, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
* See full license text in LICENSE file at top of project tree
*/
#include <boost/static_assert.hpp>
#include <string.h>
#include <openssl/rand.h>
@ -64,17 +56,17 @@ namespace data {
RAND_bytes(m_Buf, sz);
}
std::string ToBase64 () const
std::string ToBase64 (size_t len = sz) const
{
char str[sz*2];
size_t l = i2p::data::ByteStreamToBase64 (m_Buf, sz, str, sz*2);
size_t l = i2p::data::ByteStreamToBase64 (m_Buf, len, str, sz*2);
return std::string (str, str + l);
}
std::string ToBase32 () const
std::string ToBase32 (size_t len = sz) const
{
char str[sz*2];
size_t l = i2p::data::ByteStreamToBase32 (m_Buf, sz, str, sz*2);
size_t l = i2p::data::ByteStreamToBase32 (m_Buf, len, str, sz*2);
return std::string (str, str + l);
}