Skip to content

Commit

Permalink
stre
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Mar 29, 2024
1 parent 208d09b commit e38b9b6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
45 changes: 35 additions & 10 deletions CMakeProject1/compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,30 @@ int main(int argc, char *argv[])
BN_CTX_free(bz);
return -5;
}
unsigned char bc[7250] = {};
size_t wq = 7250;
unsigned char bc[750] = {};
size_t wq = 750;
bool ho = b58tobin((void*)bc, &wq, harbour.c_str(), harbour.length());
ho = b58tobin((void*)bc, &wq, harbour.c_str(), harbour.length());

unsigned char wb_final_compressed[250] = {};
unsigned char wb_f_compressed[250] = {};

wb_final_compressed[0] = 0x80;

memcpy(wb_final_compressed + 1, bc, wq);
wb_final_compressed[wq + 1] = 0x01;

unsigned char h_compressed[250] = {};
unsigned char hf_compressed[250] = {};
memcpy(wb_f_compressed, wb_final_compressed, wq + 2);
SHA256(wb_f_compressed, wq + 2, h_compressed);
SHA256(h_compressed, 32, hf_compressed);
memcpy(wb_final_compressed + wq + 2, hf_compressed, 4);
char* t_compressed = new char[750]();
size_t cw_copmressed = 750;
b58enc(t_compressed, &cw_copmressed, (void*)wb_final_compressed, (size_t)(38));


unsigned char wb_final[250] = {};
unsigned char wb_f[250] = {};
wb_final[0] = 0x80;
Expand All @@ -180,22 +199,26 @@ int main(int argc, char *argv[])
unsigned char h[250] = {};
unsigned char hf[250] = {};
memcpy(wb_f, wb_final, wq + 1);
SHA256(wb_f, 33, h);
SHA256(wb_f, wq + 1, h);
SHA256(h, 32, hf);
memcpy(wb_final + 33, hf, 4);
char* t = new char[7250]();
size_t cw = 7250;
memcpy(wb_final + wq + 1, hf, 4);
char* t = new char[750]();
size_t cw = 750;
b58enc(t, &cw, (void*)wb_final, (size_t)(1 + 32 + 4));

std::string whydah = t;
std::cout << std::endl << whydah << std::endl;
std::string mill = t_compressed;
std::cout << std::endl << mill << std::endl;

BN_free(balance_eth_ex_e);
BN_free(balance_eth_exm_e);
BN_free(balance_eth_remmi_e);
BN_free(balance_eth_h_e);
BN_free(balance_eth_f);
BN_free(balance_eth_lake);
BN_CTX_free(bz);
delete[] t_compressed;
delete[] t;
}
if ((argc == 2 == false) && std::string(argv[1]) == "-hex32_24")
Expand All @@ -212,17 +235,19 @@ int main(int argc, char *argv[])
BN_CTX_free(bz);
return -5;
}
unsigned char bc[7250] = {};
size_t wq = 7250;
unsigned char bc[850] = {};
size_t wq = 850;
bool ho = b58tobin((void*)bc, &wq, harbour.c_str(), harbour.length());
ho = b58tobin((void*)bc, &wq, harbour.c_str(), harbour.length());

unsigned char wb_final[250] = {};

memcpy(wb_final, bc, wq);
;
std::string whydah = bin2hex(wb_final, 32);
std::cout << std::endl << whydah << std::endl;

std::string draw = bin2hex(wb_final, 32);
std::cout << std::endl << draw << std::endl;

BN_free(balance_eth_ex_e);
BN_free(balance_eth_exm_e);
BN_free(balance_eth_remmi_e);
Expand Down
2 changes: 1 addition & 1 deletion CMakeProject1/decompressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(int argc , char *argv[])
unsigned char bc[3250] = {};
size_t wq = a.length() * 15;
bool ho = b58tobin((void*)bc, &wq, a.c_str(), a.length());
if (wq == 37 == false)
if (wq == 37 == false && wq == 38 == false)
{
std::cerr << std::endl << "do not mess with it" << std::endl;
return -5;
Expand Down

0 comments on commit e38b9b6

Please sign in to comment.