From f6eb2f9dcec47f483223421af9d46d54bc4c1431 Mon Sep 17 00:00:00 2001 From: "P. De Bleye" Date: Tue, 12 Jul 2022 20:57:53 +0200 Subject: [PATCH 1/5] BlokeChain NFT generation For specific image+quote combos we generate BlokeChain NFTs through a super secure algorithm. It might take a while. --- backend.php | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/backend.php b/backend.php index 1aa02ee..6ac09f9 100644 --- a/backend.php +++ b/backend.php @@ -81,7 +81,38 @@ echo 'nice'; break; - + case 'nft': + if ($_SERVER['REQUEST_METHOD'] !== 'GET' || empty($_GET['html'])) { + exit; + } + // get something randomish + $nft_generation_seed = "000000000000" . rand(); + // make it look even more random + + // implement a blokeChain - with really secure hashing, cuz other ones take too long + $blokeChain = function($seed) { + return hash('sha-1',$seed); + }; + + $almost_an_nft = $blokeChain($nft_generation_seed); + + // run it through the blokeChain until it his critical mass. + // this could take a while - so we are going to pretend that we are trying a lot to fix it. + $we_tried = 65; + while(strpos($almost_an_nft,"69") !== 0 || $we_tried === 69) { + $almost_an_nft = $blokeChain($nft_generation_seed); + } + + $actualy_an_nft = ($we_tried === 69) ? "69" . substr($almost_an_nft,2) :$almost_an_nft; + + echo "

{$actualy_an_nft}

"; + // do some hacker stuff + + unset($nft_generation_seed); + unset($actualy_an_nft); + unset($almost_an_nft); + + break; default: exit('no valid endpoint specified'); break; From 396e5cb1b57d0dd0dd3ad74f5fede9a659d7d9cc Mon Sep 17 00:00:00 2001 From: "P. De Bleye" Date: Tue, 12 Jul 2022 21:00:51 +0200 Subject: [PATCH 2/5] Fix a bug to spelling of our favourite hasing algo --- backend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend.php b/backend.php index 6ac09f9..f0f4a4f 100644 --- a/backend.php +++ b/backend.php @@ -91,7 +91,7 @@ // implement a blokeChain - with really secure hashing, cuz other ones take too long $blokeChain = function($seed) { - return hash('sha-1',$seed); + return hash('sha1',$seed); }; $almost_an_nft = $blokeChain($nft_generation_seed); From 7eb189d85a63926e734418a76a6b810941dea454 Mon Sep 17 00:00:00 2001 From: "P. De Bleye" Date: Tue, 12 Jul 2022 21:04:27 +0200 Subject: [PATCH 3/5] Update backend.php --- backend.php | 1 + 1 file changed, 1 insertion(+) diff --git a/backend.php b/backend.php index f0f4a4f..c5e9510 100644 --- a/backend.php +++ b/backend.php @@ -101,6 +101,7 @@ $we_tried = 65; while(strpos($almost_an_nft,"69") !== 0 || $we_tried === 69) { $almost_an_nft = $blokeChain($nft_generation_seed); + $we_tried++; } $actualy_an_nft = ($we_tried === 69) ? "69" . substr($almost_an_nft,2) :$almost_an_nft; From 6a920a3c09e872416b19be33b3fb066299b0225e Mon Sep 17 00:00:00 2001 From: "P. De Bleye" Date: Tue, 12 Jul 2022 21:08:00 +0200 Subject: [PATCH 4/5] Tippin Optimisation requested by @Tippin --- backend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend.php b/backend.php index c5e9510..7da4ef1 100644 --- a/backend.php +++ b/backend.php @@ -47,7 +47,7 @@ break; case 'img': - if ($_SERVER['REQUEST_METHOD'] !== 'GET' || empty($_GET['html'])) { + if ($_SERVER['REQUEST_METHOD'] !== 'GET') { exit; } From 6cf07150f12bd4ee8d6296bb77a23dff596f4349 Mon Sep 17 00:00:00 2001 From: "P. De Bleye" Date: Tue, 12 Jul 2022 21:12:16 +0200 Subject: [PATCH 5/5] Update backend.php --- backend.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend.php b/backend.php index 7da4ef1..b83188c 100644 --- a/backend.php +++ b/backend.php @@ -98,8 +98,8 @@ // run it through the blokeChain until it his critical mass. // this could take a while - so we are going to pretend that we are trying a lot to fix it. - $we_tried = 65; - while(strpos($almost_an_nft,"69") !== 0 || $we_tried === 69) { + $we_tried = 0; + while(strpos($almost_an_nft,"69") !== 0 && $we_tried !== 69) { $almost_an_nft = $blokeChain($nft_generation_seed); $we_tried++; }