这篇教程C++ DecodeBase58函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DecodeBase58函数的典型用法代码示例。如果您正苦于以下问题:C++ DecodeBase58函数的具体用法?C++ DecodeBase58怎么用?C++ DecodeBase58使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DecodeBase58函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: IsStealthAddressbool IsStealthAddress(const std::string& encodedAddress){ data_chunk raw; if (!DecodeBase58(encodedAddress, raw)) { //printf("IsStealthAddress DecodeBase58 falied./n"); return false; }; if (!VerifyChecksum(raw)) { //printf("IsStealthAddress verify_checksum falied./n"); return false; }; if (raw.size() < 1 + 1 + 33 + 1 + 33 + 1 + 1 + 4) { //printf("IsStealthAddress too few bytes provided./n"); return false; }; uint8_t* p = &raw[0]; uint8_t version = *p++; if (version != stealth_version_byte) { //printf("IsStealthAddress version mismatch 0x%x != 0x%x./n", version, stealth_version_byte); return false; }; return true;};
开发者ID:TheBitcoin,项目名称:Feathercoin2,代码行数:34,
示例2: Base58Decodestatic void Base58Decode(benchmark::State& state){ const char* addr = "17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem"; std::vector<unsigned char> vch; while (state.KeepRunning()) { DecodeBase58(addr, vch); }}
开发者ID:einalex,项目名称:syscoin,代码行数:8,
示例3: DecodeBase58std::string DecodeBase58(const char* psz){ std::vector<unsigned char> vchRet; std::string stBuf; if(DecodeBase58(psz, vchRet)) { stBuf.assign(vchRet.begin(),vchRet.end()); return stBuf; } return stBuf;}
开发者ID:wangweichaogit,项目名称:exc,代码行数:10,
示例4: DecodeBase58Checkbool DecodeBase58Check(const char *psz, std::vector<uint8_t> &vchRet) { if (!DecodeBase58(psz, vchRet) || (vchRet.size() < 4)) { vchRet.clear(); return false; } // re-calculate the checksum, insure it matches the included 4-byte checksum uint256 hash = Hash(vchRet.begin(), vchRet.end() - 4); if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) { vchRet.clear(); return false; } vchRet.resize(vchRet.size() - 4); return true;}
开发者ID:CommerciumBlockchain,项目名称:Commercium_Deprecated,代码行数:14,
示例5: DecodeBase58std::string DecodeBase58(const char* psz){ std::vector<unsigned char> vch; DecodeBase58(psz, vch); std::stringstream ss; ss << std::hex; for (unsigned int i = 0; i < vch.size(); i++) { unsigned char* c = &vch[i]; ss << setw(2) << setfill('0') << (int)c[0]; } return ss.str();}
开发者ID:ApollonMax,项目名称:ApollonCore,代码行数:14,
示例6: printfbool CStealthAddress::SetEncoded(const std::string& encodedAddress){ data_chunk raw; if (!DecodeBase58(encodedAddress, raw)) { if (fDebug) printf("CStealthAddress::SetEncoded DecodeBase58 falied./n"); return false; }; if (!VerifyChecksum(raw)) { if (fDebug) printf("CStealthAddress::SetEncoded verify_checksum falied./n"); return false; }; if (raw.size() < 1 + 1 + 33 + 1 + 33 + 1 + 1 + 4) { if (fDebug) printf("CStealthAddress::SetEncoded() too few bytes provided./n"); return false; }; uint8_t* p = &raw[0]; uint8_t version = *p++; if (version != stealth_version_byte) { printf("CStealthAddress::SetEncoded version mismatch 0x%x != 0x%x./n", version, stealth_version_byte); return false; }; options = *p++; scan_pubkey.resize(33); memcpy(&scan_pubkey[0], p, 33); p += 33; //uint8_t spend_pubkeys = *p++; p++; spend_pubkey.resize(33); memcpy(&spend_pubkey[0], p, 33); return true;};
开发者ID:TheBitcoin,项目名称:Feathercoin2,代码行数:48,
示例7: DecodeBase58Check bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet) { if (!DecodeBase58(psz, vchRet) || (vchRet.size() < 4)) { vchRet.clear(); return false; } // re-calculate the checksum, ensure it matches the included 4-byte checksum uint256 hash = doubleSha256(reinterpret_cast<const char*>(vchRet.data()), vchRet.size() - 4); if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) { vchRet.clear(); return false; } vchRet.resize(vchRet.size() - 4); return true; }
开发者ID:DimanNe,项目名称:scripts,代码行数:16,
示例8: DecodeBase58Check// Decode a base58-encoded string psz that includes a checksum, into byte vector vchRet// returns true if decoding is successfulbool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet){ if (!DecodeBase58(psz, vchRet)) return false; if (vchRet.size() < 4) { vchRet.clear(); return false; } uint256 hash = Hash(vchRet.begin(), vchRet.end()-4); if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) { vchRet.clear(); return false; } vchRet.resize(vchRet.size()-4); return true;}
开发者ID:5mil,项目名称:Scryptic,代码行数:20,
示例9: DecodeBase58bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet) { return DecodeBase58(str.c_str(), vchRet);}
开发者ID:jiao12heng,项目名称:digitalcoin,代码行数:3,
示例10: DecodeBase58bool DecodeBase58(const std::string &str, std::vector<uint8_t> &vchRet) { return DecodeBase58(str.c_str(), vchRet);}
开发者ID:CommerciumBlockchain,项目名称:Commercium_Deprecated,代码行数:3,
示例11: IsStealthAddress// stealth addresses have the ticker suffixbool IsStealthAddress(const std::string& qualAddress){ std::string encodedAddress;#if USE_QUALIFIED_ADDRESSES int nColor; if (!SplitQualifiedAddress(qualAddress, encodedAddress, nColor, fDebug)) { if (fDebug) { printf("StealthAddress::IsStealthAddress: could not split address../n"); } return false; }#else encodedAddress = qualAddress;#endif data_chunk raw; if (!DecodeBase58(encodedAddress, raw)) { if (fDebug) { printf("IsStealthAddress: DecodeBase58 falied./n"); } return false; }; if (!VerifyChecksum(raw)) { if (fDebug) { printf("IsStealthAddress: verify_checksum falied./n"); } return false; }; if (raw.size() < N_COLOR_BYTES + 1 + 1 + 33 + 1 + 33 + 1 + 1 + 4) { if (fDebug) { printf("IsStealthAddress: too few bytes provided./n"); } return false; }; uint8_t* p = &raw[0]; int nColor = 0; for (int i = 0; i < N_COLOR_BYTES; ++i) { nColor += pow(256, (int) i) * ((int) *p); ++p; } if (!CheckColor(nColor)) { if (fDebug) { printf("IsStealthAddress: Invalid currency %d./n", nColor); } } uint8_t version = *p++; if (version != stealth_version_byte) { if (fDebug) { printf("IsStealthAddress version mismatch 0x%x != 0x%x./n", version, stealth_version_byte); } return false; }; return true;};
开发者ID:BreakoutCoin,项目名称:Breakout-Chain-Client,代码行数:78,
示例12: printf// color information is stored strting in the second byte so that// addresses for different colors have distinct starting sequencesbool CStealthAddress::SetEncoded(const std::string& encodedAddress){ data_chunk raw; if (!DecodeBase58(encodedAddress, raw)) { if (fDebug) printf("CStealthAddress::SetEncoded DecodeBase58 falied./n"); return false; }; if (!VerifyChecksum(raw)) { if (fDebug) printf("CStealthAddress::SetEncoded verify_checksum falied./n"); return false; }; size_t nRawSize = raw.size(); // see CStealthAddress::Encoded() // Put color first so that stealth addresses of different currencies look different // N_COLOR_BYTES, 1-version, 1-options, 33-scan_pubkey, 1-#spend_pubkeys, // 33-spend_pubkey, 1-#sigs, 1-?, 4 checksum if (nRawSize < N_COLOR_BYTES + 1 + 1 + 33 + 1 + 33 + 1 + 1 + 4) { if (fDebug) printf("CStealthAddress::SetEncoded() too few bytes provided./n"); return false; }; uint8_t* p = &raw[0]; // Stealth addresses store color as a simple index little bytes first. this->nColor = 0; for (int i = 0; i < N_COLOR_BYTES; ++i) { this->nColor += pow(256, (int) i) * ((int) *p); ++p; } if (!CheckColor(nColor)) { printf("CStealthAddress::SetEncoded(): Color %d is not valid (1...%d)./n", this->nColor, N_COLORS); } uint8_t version = *p++; if (version != stealth_version_byte) { printf("CStealthAddress::SetEncoded version mismatch 0x%x != 0x%x./n", version, stealth_version_byte); return false; }; options = *p++; scan_pubkey.resize(33); memcpy(&scan_pubkey[0], p, 33); p += 33; //uint8_t spend_pubkeys = *p++; p++; spend_pubkey.resize(33); memcpy(&spend_pubkey[0], p, 33); return true;};
开发者ID:BreakoutCoin,项目名称:Breakout-Chain-Client,代码行数:71,
注:本文中的DecodeBase58函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DecodeBase64函数代码示例 C++ DeclareCallBackEntry函数代码示例 |