mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
use RsRandom::alphaNumeric
This commit is contained in:
parent
8323b94a6a
commit
f18d49db48
@ -945,13 +945,9 @@ void p3I2pBob::finalizeSettings_locked()
|
|||||||
// setup commands
|
// setup commands
|
||||||
// new lines are appended later!
|
// new lines are appended later!
|
||||||
|
|
||||||
// generate random suffix for name
|
// generate 8 characater long random suffix for name
|
||||||
// RSRandom::random_alphaNumericString can return very weird looking strings like: ,,@z+M
|
constexpr size_t len = 8;
|
||||||
// use base32 instead
|
const std::string location = RsRandom::alphaNumeric(len);
|
||||||
size_t len = 5; // 5 characters = 8 base32 symbols
|
|
||||||
std::vector<uint8_t> tmp(len);
|
|
||||||
RSRandom::random_bytes(tmp.data(), len);
|
|
||||||
const std::string location = Radix32::encode(tmp.data(), len);
|
|
||||||
RS_DBG4("using suffix ", location);
|
RS_DBG4("using suffix ", location);
|
||||||
mTunnelName = "RetroShare-" + location;
|
mTunnelName = "RetroShare-" + location;
|
||||||
|
|
||||||
|
@ -5,14 +5,6 @@
|
|||||||
|
|
||||||
namespace i2p {
|
namespace i2p {
|
||||||
|
|
||||||
const std::string generateNameSuffix(const size_t len) {
|
|
||||||
std::vector<uint8_t> tmp(len);
|
|
||||||
RsRandom::random_bytes(tmp.data(), len);
|
|
||||||
const std::string location = Radix32::encode(tmp.data(), len);
|
|
||||||
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string keyToBase32Addr(const std::string &key)
|
std::string keyToBase32Addr(const std::string &key)
|
||||||
{
|
{
|
||||||
std::string copy(key);
|
std::string copy(key);
|
||||||
|
@ -184,19 +184,6 @@ static const std::array<std::pair<uint16_t, uint16_t>, 12> signingKeyLengths {
|
|||||||
/*SigningKeyType::RedDSA_SHA512_Ed25519 */ std::make_pair<uint16_t, uint16_t>( 32, 32),
|
/*SigningKeyType::RedDSA_SHA512_Ed25519 */ std::make_pair<uint16_t, uint16_t>( 32, 32),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief generateNameSuffix Generates a base32 name suffix for tunnel identification
|
|
||||||
* @param len lenght of random bytes, will be expanded by base32 encoding
|
|
||||||
* @return base32 string
|
|
||||||
*
|
|
||||||
* RSRandom::random_alphaNumericString can return very weird looking strings like: ,,@z+M
|
|
||||||
* -> so use base32 instead
|
|
||||||
*
|
|
||||||
* 5 characters = 8 base32 symbols
|
|
||||||
*/
|
|
||||||
const std::string generateNameSuffix(const size_t len = 5);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief makeOption Creates the string "lhs=rhs" used by BOB and SAM. Converts rhs
|
* @brief makeOption Creates the string "lhs=rhs" used by BOB and SAM. Converts rhs
|
||||||
* @param lhs option to set
|
* @param lhs option to set
|
||||||
|
Loading…
Reference in New Issue
Block a user