MCPcopy Create free account
hub / github.com/JeanLucPons/VanitySearch / GetPrivAddress

Method GetPrivAddress

SECP256K1.cpp:603–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601}
602
603std::string Secp256K1::GetPrivAddress(bool compressed,Int &privKey) {
604
605 unsigned char address[38];
606
607 address[0] = 0x80; // Mainnet
608 privKey.Get32Bytes(address + 1);
609
610 if( compressed ) {
611
612 // compressed suffix
613 address[33] = 1;
614 sha256_checksum(address, 34, address + 34);
615 return EncodeBase58(address,address + 38);
616
617 } else {
618
619 // Compute checksum
620 sha256_checksum(address, 33, address + 33);
621 return EncodeBase58(address,address + 37);
622
623 }
624
625}
626
627#define CHECKSUM(buff,A) \
628(buff)[0] = (uint32_t)A[0] << 24 | (uint32_t)A[1] << 16 | (uint32_t)A[2] << 8 | (uint32_t)A[3];\

Callers 3

checkPrivKeyMethod · 0.80
generateKeyPairFunction · 0.80
mainFunction · 0.80

Calls 3

sha256_checksumFunction · 0.85
EncodeBase58Function · 0.85
Get32BytesMethod · 0.80

Tested by

no test coverage detected