mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-01-22 21:37:18 +01:00
prefix
This commit is contained in:
parent
8a3d610abb
commit
2b1f950d4b
|
@ -19,7 +19,25 @@ static uint8_t * PaddingBuf;
|
|||
static unsigned long long hash;
|
||||
|
||||
#define CPU_ONLY
|
||||
static bool check_prefix(const char * buf){
|
||||
unsigned short size_str=0;
|
||||
while(*buf)
|
||||
{
|
||||
if(
|
||||
*buf < 48
|
||||
||
|
||||
(*buf > 57 && *buf < 65)
|
||||
||
|
||||
(*buf > 64 && *buf < 94)
|
||||
|| *buf > 125
|
||||
|| size_str > 52
|
||||
)return false;
|
||||
size_str++;
|
||||
*buf++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef CPU_ONLY
|
||||
static inline bool NotThat(const char * a, const char *b){
|
||||
|
@ -66,6 +84,10 @@ int main (int argc, char * argv[])
|
|||
std::cout << "Usage: " << argv[0] << " filename generatestring <signature type>" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
if(!check_prefix(argv[2])){
|
||||
std::cout << "Not correct prefix" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
i2p::crypto::InitCrypto (false);
|
||||
type = i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519;
|
||||
if ( argc > 3 )
|
||||
|
|
Loading…
Reference in a new issue