本文整理汇总了C++中uint256::size方法的典型用法代码示例。如果您正苦于以下问题:C++ uint256::size方法的具体用法?C++ uint256::size怎么用?C++ uint256::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uint256
的用法示例。
在下文中一共展示了uint256::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ForEachMN
std::vector<std::pair<arith_uint256, CDeterministicMNCPtr>> CDeterministicMNList::CalculateScores(const uint256& modifier) const
{
std::vector<std::pair<arith_uint256, CDeterministicMNCPtr>> scores;
scores.reserve(GetAllMNsCount());
ForEachMN(true, [&](const CDeterministicMNCPtr& dmn) {
if (dmn->pdmnState->confirmedHash.IsNull()) {
// we only take confirmed MNs into account to avoid hash grinding on the ProRegTxHash to sneak MNs into a
// future quorums
return;
}
// calculate sha256(sha256(proTxHash, confirmedHash), modifier) per MN
// Please note that this is not a double-sha256 but a single-sha256
// The first part is already precalculated (confirmedHashWithProRegTxHash)
// TODO When https://github.com/bitcoin/bitcoin/pull/13191 gets backported, implement something that is similar but for single-sha256
uint256 h;
CSHA256 sha256;
sha256.Write(dmn->pdmnState->confirmedHashWithProRegTxHash.begin(), dmn->pdmnState->confirmedHashWithProRegTxHash.size());
sha256.Write(modifier.begin(), modifier.size());
sha256.Finalize(h.begin());
scores.emplace_back(UintToArith256(h), dmn);
});
return scores;
}
示例2: sign
void RippleAddress::sign(uint256 const& message, Blob& retSignature) const
{
assert(vchData.size() == 64);
const unsigned char *key = vchData.data();
retSignature.resize(crypto_sign_BYTES);
crypto_sign_detached(&retSignature[0], NULL,
(unsigned char*)message.begin(), message.size(),
key);
}
示例3: sign
void PaysharesPrivateKey::sign(uint256 const& message, Blob& retSignature) const
{
unsigned char out[crypto_sign_BYTES + message.bytes];
unsigned long long len;
const unsigned char *key = mPair.mPrivateKey.data();
// contrary to the docs it puts the signature in front
crypto_sign(out, &len,
(unsigned char*)message.begin(), message.size(),
key);
retSignature.resize(crypto_sign_BYTES);
memcpy(&retSignature[0], out, crypto_sign_BYTES);
}
示例4: ECDSAPrivateKey
ec_key ECDSAPrivateKey (uint256 const& serialized)
{
BIGNUM* bn = BN_bin2bn (serialized.begin(), serialized.size(), nullptr);
if (bn == nullptr)
{
throw std::runtime_error ("ec_key::ec_key: BN_bin2bn failed");
}
EC_KEY* key = new_initialized_EC_KEY();
const bool ok = EC_KEY_set_private_key (key, bn);
BN_clear_free (bn);
if (! ok)
{
EC_KEY_free (key);
}
return ec_key::acquire ((ec_key::pointer_t) key);
}