mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-06-18 04:00:03 +02:00
core/string.h: move base58 functions to crypto/base58.h
This commit is contained in:
parent
040d3457ef
commit
4a64da310b
5 changed files with 23 additions and 13 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include <cstddef>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#include "../crypto/base58.h"
|
||||
#include "string.h"
|
||||
|
||||
namespace eoskeygen {
|
||||
|
|
@ -88,18 +89,6 @@ std::string& trim(std::string& str) {
|
|||
return ltrim(rtrim(str));
|
||||
}
|
||||
|
||||
static bool _is_base58(char ch) {
|
||||
static std::string alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
return alphabet.find(ch) != std::string::npos;
|
||||
}
|
||||
|
||||
std::string& base58_strip(std::string &str) {
|
||||
str.erase(std::remove_if(str.begin(), str.end(), [] (std::string::value_type ch)
|
||||
{ return !_is_base58(ch); }
|
||||
), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
strlist_t& base58_strip(strlist_t& list) {
|
||||
|
||||
std::transform(list.begin(), list.end(), list.begin(), [](std::string& str){ return base58_strip(str); });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue