Skip to content

Commit

Permalink
o2 flag + fedora depedencies support + #92 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wipedlifepotato committed Sep 5, 2023
1 parent 314ab73 commit 92989e6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
83 changes: 43 additions & 40 deletions dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 2 additions & 7 deletions vain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions vanity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;}

0 comments on commit 92989e6

Please sign in to comment.