Browse Source

Merge pull request #94 from wipedlifepotato/master

o2 flag + fedora depedencies support + #92 issue
pull/100/head
orignal 1 year ago committed by GitHub
parent
commit
cf0c9c9d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 @@ -7,7 +7,7 @@ LIBI2PD_PATH = $(I2PD_PATH)/libi2pd
LIBI2PD_CLIENT_PATH = $(I2PD_PATH)/libi2pd_client
CXX ?= g++
CXXFLAGS = -Wall -std=c++17
CXXFLAGS = -Wall -std=c++17 -O2
INCFLAGS = -I$(LIBI2PD_PATH) -I$(LIBI2PD_CLIENT_PATH)
DEFINES = -DOPENSSL_SUPPRESS_DEPRECATED

83
dependencies.sh

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

9
vain.cpp

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

5
vanity.hpp

@ -84,3 +84,8 @@ const uint8_t lastBlock[64] = @@ -84,3 +84,8 @@ const uint8_t lastBlock[64] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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