Browse Source

o2 flag + fedora depedencies support + #92 issue

pull/94/head
Ваше имяэ 8 months ago
parent
commit
92989e649a
  1. 2
      Makefile
  2. 83
      dependencies.sh
  3. 9
      vain.cpp
  4. 5
      vanity.hpp

2
Makefile

@ -7,7 +7,7 @@ LIBI2PD_PATH = $(I2PD_PATH)/libi2pd
LIBI2PD_CLIENT_PATH = $(I2PD_PATH)/libi2pd_client LIBI2PD_CLIENT_PATH = $(I2PD_PATH)/libi2pd_client
CXX ?= g++ CXX ?= g++
CXXFLAGS = -Wall -std=c++17 CXXFLAGS = -Wall -std=c++17 -O2
INCFLAGS = -I$(LIBI2PD_PATH) -I$(LIBI2PD_CLIENT_PATH) INCFLAGS = -I$(LIBI2PD_PATH) -I$(LIBI2PD_CLIENT_PATH)
DEFINES = -DOPENSSL_SUPPRESS_DEPRECATED DEFINES = -DOPENSSL_SUPPRESS_DEPRECATED

83
dependencies.sh

@ -8,61 +8,64 @@ dependNix="libboost-chrono-dev \
libboost-thread-dev \ libboost-thread-dev \
libssl-dev \ libssl-dev \
zlib1g-dev" zlib1g-dev"
dependWin="mingw-w64-x86_64-boost \ dependWin="mingw-w64-x86_64-boost \
mingw-w64-x86_64-openssl \ mingw-w64-x86_64-openssl \
mingw-w64-x86_64-zlib" mingw-w64-x86_64-zlib"
kernel=`uname -a` kernel=$(uname -a)
function isLsbReleaseExists() {
if which lsb_release > /dev/null; # do whereis can be too? function anotherDistr() {
then echo "Just install libboost and libopenssl dev packages on your pc"
return 0 return 0
else
return 1
fi
} }
function anotherDistr(){ function installDnf() {
echo "Just install libboost and libopenssl dev packages on your pc"; sudo dnf install boost-devel g++
return 0
} }
function installDeb(){ function installDeb() {
sudo apt-get install $dependNix; sudo apt-get install $dependNix
return 0 return 0
} }
function installOnGentoo(){
sudo emerge --deep --newuse dev-libs/boost dev-libs/openssl; function installOnGentoo() {
return 0 sudo emerge --deep --newuse dev-libs/boost dev-libs/openssl
return 0
} }
function installOnWin() { function installOnWin() {
pacman -S $depenWin; pacman -S $dependWin
return 0 return 0
} }
function doInstallDepencies() { function doInstallDepencies() {
case "$1" in case "$1" in
*Ubuntu*|*Debian*) *Ubuntu* | *Debian*)
installDeb installDeb
;; ;;
*gentoo*) *gentoo*)
installOnGentoo installOnGentoo
;; ;;
*MINGW64*) *MINGW64*)
installOnWin installOnWin
;; ;;
*) *dnf*)
anotherDistr installDnf
;; ;;
esac *)
anotherDistr
;;
esac
} }
if isLsbReleaseExists ; isLsbReleaseExists=$(which lsb_release > /dev/null 2>&1; echo $?)
then if [ $isLsbReleaseExists -eq 0 ]; then
distr=`lsb_release -i` distr=$(lsb_release -i)
doInstallDepencies "$distr" doInstallDepencies "$distr"
else # elif test -e /etc/fedora-release || which dnf > /dev/null; then
doInstallDepencies "$kernel" printf "Like you use fedora/redhat distr\n"
doInstallDepencies "dnf"
else
doInstallDepencies "$kernel"
fi fi

9
vain.cpp

@ -404,10 +404,7 @@ int main (int argc, char * argv[])
{ {
//keys = i2p::data::PrivateKeys::CreateRandomKeys (options.signature); //keys = i2p::data::PrivateKeys::CreateRandomKeys (options.signature);
//RAND_bytes( KeyBuf+MutateByte , 90 ); // FoundNonce is //RAND_bytes( KeyBuf+MutateByte , 90 ); // FoundNonce is
DELKEYBUFS(options.threads);
for (unsigned i = options.threads-1;i--;)
delete [] KeyBufs[i];
delete [] KeyBufs;
std::cout << "(Generate a new keypair) Attempts #" << ++attempts << std::endl; std::cout << "(Generate a new keypair) Attempts #" << ++attempts << std::endl;
return 1; return 1;
} }
@ -445,9 +442,7 @@ int main (int argc, char * argv[])
if (f) if (f)
{ {
f.write ((char *)KeyBuf, keys_len); f.write ((char *)KeyBuf, keys_len);
for (unsigned i = options.threads-1;i--;) DELKEYBUFS(options.threads);
delete [] KeyBufs[i];
delete [] KeyBufs;
} }
else else
std::cout << "Can't create file " << options.outputpath << std::endl; std::cout << "Can't create file " << options.outputpath << std::endl;

5
vanity.hpp

@ -84,3 +84,8 @@ const uint8_t lastBlock[64] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x38 // 3128 bits (391 bytes) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x38 // 3128 bits (391 bytes)
}; };
#define DELKEYBUFS(S) {\
for (unsigned i = S-1;i--;) \
delete [] KeyBufs[i];\
delete [] KeyBufs;}

Loading…
Cancel
Save