本文整理汇总了C++中fc::ecc::public_key类的典型用法代码示例。如果您正苦于以下问题:C++ public_key类的具体用法?C++ public_key怎么用?C++ public_key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了public_key类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: matchContact
bool matchContact(const fc::ecc::public_key& pk, bts::addressbook::wallet_contact* matchedContact)
{
assert(pk.valid());
auto address_book = bts::get_profile()->get_addressbook();
try
{
auto c = address_book->get_contact_by_public_key(pk);
if(c)
{
*matchedContact = *c;
return true;
}
else
{
*matchedContact = bts::addressbook::wallet_contact();
matchedContact->public_key = pk;
return false;
}
}
catch (const fc::exception&)
{
*matchedContact = bts::addressbook::wallet_contact();
matchedContact->public_key = pk;
return false;
}
}
开发者ID:BrownBear2,项目名称:keyhotee,代码行数:27,代码来源:utils.cpp
示例2: sizeof
address::address( const fc::ecc::public_key& pub )
{
auto dat = pub.serialize();
auto dat_hash = small_hash(dat.data, sizeof(dat) );
auto check = fc::ripemd160::hash( (char*)&dat_hash, 16 );
memcpy( addr.data, (char*)&dat_hash, sizeof(addr) );
memcpy( &addr.data[16], (char*)&check, 4 );
}
开发者ID:BrownBear2,项目名称:BitShares,代码行数:8,代码来源:address.cpp
示例3: sizeof
pts_address::pts_address( const fc::ecc::public_key& pub, bool compressed, uint8_t version )
{
fc::sha256 sha2;
if( compressed )
{
auto dat = pub.serialize();
sha2 = fc::sha256::hash(dat.data, sizeof(dat) );
}
else
{
auto dat = pub.serialize_ecc_point();
sha2 = fc::sha256::hash(dat.data, sizeof(dat) );
}
auto rep = fc::ripemd160::hash((char*)&sha2,sizeof(sha2));
addr.data[0] = version;
memcpy( addr.data+1, (char*)&rep, sizeof(rep) );
auto check = fc::sha256::hash( addr.data, sizeof(rep)+1 );
check = fc::sha256::hash(check); // double
memcpy( addr.data+1+sizeof(rep), (char*)&check, 4 );
}
开发者ID:NimroDeer,项目名称:BitShares,代码行数:20,代码来源:pts_address.cpp
示例4:
bool operator == ( const public_key_type& p1, const fc::ecc::public_key& p2)
{
return p1.key_data == p2.serialize();
}
开发者ID:AlexChien,项目名称:bitshares,代码行数:4,代码来源:types.cpp
示例5: sizeof
address::address( const fc::ecc::public_key& pub )
{
auto dat = pub.serialize();
addr = fc::ripemd160::hash( fc::sha512::hash( dat.data, sizeof( dat ) ) );
}
开发者ID:NameShares,项目名称:nameshares,代码行数:5,代码来源:address.cpp
示例6: pack
void pack( Stream& s, const fc::ecc::public_key& pk)
{
fc::raw::pack( s, pk.serialize() );
}
开发者ID:Bitcoinsulting,项目名称:fc,代码行数:4,代码来源:elliptic.hpp
示例7: toString
QString toString(const fc::ecc::public_key& pk, TContactTextFormatting contactFormatting,
bts::addressbook::contact* matchingContact /*= nullptr*/, bool* isKnownContact /*= nullptr*/)
{
assert(pk.valid());
auto address_book = bts::get_profile()->get_addressbook();
auto c = address_book->get_contact_by_public_key(pk);
if (c)
{
if(matchingContact != nullptr)
*matchingContact = *c;
if(isKnownContact != nullptr)
*isKnownContact = true;
switch(contactFormatting)
{
case KEYHOTEE_IDENTIFIER:
return QString(c->dac_id_string.c_str());
case CONTACT_ALIAS_FULL_NAME:
return QString(std::string(c->first_name + " " + c->last_name).c_str());
case FULL_CONTACT_DETAILS:
return QString(c->get_display_name().c_str());
default:
assert(false);
return QString();
}
}
else
{
auto profile = bts::get_profile();
/// If no contact found try one of registered identities.
std::vector<bts::addressbook::wallet_identity> identities = profile->identities();
for(const auto& identity : identities)
{
assert(identity.public_key.valid());
if(identity.public_key == pk)
{
if(matchingContact != nullptr)
*matchingContact = identity;
if(isKnownContact != nullptr)
*isKnownContact = true;
switch(contactFormatting)
{
case KEYHOTEE_IDENTIFIER:
return QString::fromStdString(identity.dac_id_string);
case CONTACT_ALIAS_FULL_NAME:
return QString::fromStdString(std::string(identity.first_name + " " + identity.last_name));
case FULL_CONTACT_DETAILS:
return QString::fromStdString(identity.get_display_name());
default:
assert(false);
return QString();
}
break;
}
}
if(matchingContact != nullptr)
{
*matchingContact = bts::addressbook::wallet_contact();
matchingContact->public_key = pk;
}
if(isKnownContact != nullptr)
*isKnownContact = false;
/// If code reached this point the publick key is unknown - lets display it as base58
return QString::fromStdString(pk.to_base58());
}
}
开发者ID:BrownBear2,项目名称:keyhotee,代码行数:72,代码来源:utils.cpp
示例8: pack
void pack( Stream& s, const fc::ecc::public_key& pk, uint32_t _max_depth )
{
FC_ASSERT( _max_depth > 0 );
fc::raw::pack( s, pk.serialize(), _max_depth - 1 );
}
开发者ID:bitshares,项目名称:fc,代码行数:5,代码来源:elliptic.hpp
注:本文中的fc::ecc::public_key类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论