From 24968ddc4e27aecd4ee2454c000875e6953c2aec Mon Sep 17 00:00:00 2001 From: Garima Chauhan Date: Fri, 26 Apr 2024 17:41:59 +0530 Subject: [PATCH] learnt to hash in cpp --- mine | Bin 40360 -> 40368 bytes mine.cpp | 55 +- output.txt | 8132 +------------------------------------ trying_openssl_sha256 | Bin 0 -> 25456 bytes trying_openssl_sha256.cpp | 38 + 5 files changed, 84 insertions(+), 8141 deletions(-) create mode 100755 trying_openssl_sha256 create mode 100644 trying_openssl_sha256.cpp diff --git a/mine b/mine index 1e58b5d4b940355dea370cbe63660cb94445c2d6..084fa464a2a2e2a80e576ee1ffb12dc5e8bafa73 100755 GIT binary patch delta 5363 zcmZWt3s{s@8b1He%)p??;BAIcXTS>ya#uuo(l9O#7nMwn%n%h7EPHUnQlDyIg=$1f z{k*Wc?ON+o+Fm5bTGTYK3t84;nbD2q*?eS_OJbJ9mb33U{~03oJP-eS&ih@?cfRkO z^Z&!)Q)=BQb;o3-ZfE2x#{5xCwEUf4#06GZwLyiIhAXkgLqoOUA$OJ%r;ZFbTfTm_ z|EY5ejq9hZ8Dm{IeyD9PZTBlvUMEFoRz`^D5=uZni4y$HiiaBUw1}r7q(y@NjO$RT z!J-_Y9%z3>7Yt@4nZosPN`SC`MLc&3o0o)5qhLHje+V?qN-npeI=w|%B<#Ny8YhIt z2BEP+@R6b)BAy2XlPNTx5Z+IT=x*^oIs7e(i&ps0RW=E>kUv8|HZT^##<0{P{CoO`D&cee%wsEQx8 z2gf*nhI11v!tj?Dv3Uq%fo!C|=0ah5)+ObIpf+DP3V8q<3puyh+`CU@%%4Td@ux>0 zLNIzZLypTLcOh0COOxXbLf?-qz?e6M`AuhmQpkysB_%m z8(|qKw0zP_T>m*eIU=H*O;tKr@Id;Ft1R3{wFc093k!6(sset?{-CiYuvh0J|1cLC z+%*>9aGeEH$ZcF=KILZ-UpZ%L_6R{uP=qs-tA5M_dW2im)MyG-ZO}W(t1hMYYUT%p z!zRyVZP*}(pNZifF{}}`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ALkkkn+`C&elWjmD|&*dp#}3;u-1+DZeZ;k$Z@>L(X#ukt6kF z;@3xy(<0Z|b8OOSNs&ca%%8bOq|JBo#=z{0@|lzu$W98Sd;o4xKBC}6UEs-WiIj)R z<&mq$J|*ROi}D?RPQ5Q}w#zl0B4axG=`sH$`|`xxFXcZ=d(Wky+Hi1bpW3V6yk|NQAc0H$yr94QEe<0J#*HYf~utg2f<7CQx@R+n;rOUHfk-P{! zi*Q9c9Fi%ES1O#+(GwpEliP5-3{)iL+vQORmhvAV*C(M_T3nag2DgJKcRMTs2I;XY zWG-?KvS%R|(-iliwAd)8+OzDzct!H8x-P-RyZS h^Smso$GH5eycK1YEAaIvRb>lJe using namespace std; -//create a serialise function to serialise txns + +struct Output { + int Amount; + string ScriptPubKey; +} + +struct Input { + string txId; + int vOut; + string scriptSig; + string sequence; + vector witness; + vector prevout; + string scriptSigAsm; + bool isCoinbase; +} + +struct Txn { + int version; + int locktime; + vector vin; + vector vout; + +} + +string serialise(string content) { + string serialised; + int sz = content.size(); + return serialised; +} int main() { @@ -12,21 +41,27 @@ int main() { ifstream myfile; myfile.open("txns.txt"); - string mystring; - + string filename; vector txns; while (myfile.good()) { - getline(myfile,mystring); - txns.push_back(mystring); + getline(myfile,filename); + txns.push_back(filename); } myfile.close(); - for (string txn: txns) { - string filename = "mempool/" + txn; - myfile.open(filename); - //getline(myfile,mystring); - //cout<m(Cr-az6? ziyP848`DO&w02wDxZAG%VYjqf{m^!;qgcRhweeGH>HcVGi@TFTYm9cyx=8kW?vFQj zUglX6{cm$&a^5-joO91P_s6^M*ZG*gc2l0m!&J#UMeV6vZCX|@&KTURkGRm z>t&a-3xF4Jny9Z50JWl=$jgQ^B|RUIO+p3hHvay;8~VfR$V+V+!hW6r0kuLawwn8>Xe-%cQ)Lqi~U&A>|Ay zr=VBHQ$ZC^vXOq3Qm+#_%w|rxRw?I%)zC>rL283a;AN|6D(%%txoT;U6P^<4nS!dl z?U19moNp8#yt@pI6Y>dveg9gVJ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^uQY%VcL3;kI%iGVXs)Uf5=Sqc=Q}|^N zCYox$s!qyPN$6-_l0_x{ULo6;!_B5Ikc{%NgiTlKbg25?X2O9XQw3VqsCE_OTpZ+*uewce(6 +#include +#include +#include +#include + +bool computeHash(const std::string& unhashed, std::string& hashed) { + bool success =false; + EVP_MD_CTX* context = EVP_MD_CTX_new(); + + if (context != NULL) { + if (EVP_DigestInit_ex(context, EVP_sha256(),NULL)) { + if (EVP_DigestUpdate(context, unhashed.c_str(), unhashed.length())) { + unsigned char hash[EVP_MAX_MD_SIZE]; + unsigned int lengthOfHash = 0; + if (EVP_DigestFinal_ex(context, hash, &lengthOfHash)) { + std::stringstream ss; + for (unsigned int i=0; i