当前位置: 首页>>代码示例>>C++>>正文


C++ Blob::data方法代码示例

本文整理汇总了C++中Blob::data方法的典型用法代码示例。如果您正苦于以下问题:C++ Blob::data方法的具体用法?C++ Blob::data怎么用?C++ Blob::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blob的用法示例。


在下文中一共展示了Blob::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: accountPrivateSign

Blob RippleAddress::accountPrivateSign (Blob const& message) const
{
    if (vchData.size() == 33  &&  vchData[0] == 0xED)
    {
        uint8_t const*      secretKey = &vchData[1];
        ed25519_public_key  publicKey;
        Blob                signature (sizeof (ed25519_signature));

        ed25519_publickey (secretKey, publicKey);

        ed25519_sign (
            message.data(), message.size(), secretKey, publicKey,
            &signature[0]);

        assert (isCanonicalEd25519Signature (signature.data()));

        return signature;
    }

    Blob result = ECDSASign(
        sha512Half(makeSlice(message)), getAccountPrivate());
    bool const ok = !result.empty();

    CondLog (!ok, lsWARNING, RippleAddress)
            << "accountPrivateSign: Signing failed.";

    return result;
}
开发者ID:CFQuantum,项目名称:CFQuantumd,代码行数:28,代码来源:RippleAddress.cpp

示例2:

bool
PublicKey::checkSignature(const Blob& data, const Blob& signature) const {
    if (!pk)
        return false;
    const gnutls_datum_t sig {(uint8_t*)signature.data(), (unsigned)signature.size()};
    const gnutls_datum_t dat {(uint8_t*)data.data(), (unsigned)data.size()};
    int rc = gnutls_pubkey_verify_data2(pk, GNUTLS_SIGN_RSA_SHA512, 0, &dat, &sig);
    return rc >= 0;
}
开发者ID:mrobado,项目名称:opendht,代码行数:9,代码来源:crypto.cpp

示例3: Export

Blob CngKey::Export(CngKeyBlobFormat format) const {
	EVP_PKEY* key = ToKey(_self);
	Blob r;
	int size;
	byte *buf;
	switch (format) {
	case CngKeyBlobFormat::OSslEccPrivateBlob:
		SslCheck((size = ::i2d_PrivateKey(key, 0)) >= 0);
		r.Size = size;
		SslCheck(::i2d_PrivateKey(key, &(buf = r.data())) == size);
		break;
	case CngKeyBlobFormat::OSslEccPrivateBignum:
		{
			const BIGNUM *bn = ::EC_KEY_get0_private_key(key->pkey.ec);
			SslCheck(bn);
			r.Size = BN_num_bytes(bn);
			if (::BN_bn2bin(bn, r.data()) != r.Size)
				Throw(E_FAIL);
		}
		break;
	case CngKeyBlobFormat::OSslEccPublicBlob:
//		SslCheck(size = ::i2o_ECPublicKey(key, 0));
		SslCheck((size = ::i2d_PublicKey(key, 0)) >= 0);
		r.Size = size;
//		SslCheck(::i2o_ECPublicKey(key, &(buf = r.data())) == size);
		SslCheck(::i2d_PublicKey(key, &(buf = r.data())) == size);
		break;
	case CngKeyBlobFormat::OSslEccPublicCompressedBlob:
		{
			CngKey tmp = _self;
			key = ToKey(tmp);
			::EC_KEY_set_conv_form(key->pkey.ec, POINT_CONVERSION_COMPRESSED);
			r = tmp.Export(CngKeyBlobFormat::OSslEccPublicBlob);
		}
		break;
	case CngKeyBlobFormat::OSslEccPublicUncompressedBlob:
		{
			CngKey tmp = _self;
			key = ToKey(tmp);
			::EC_KEY_set_conv_form(key->pkey.ec, POINT_CONVERSION_UNCOMPRESSED);
			r = tmp.Export(CngKeyBlobFormat::OSslEccPublicBlob);
		}
		break;
	case CngKeyBlobFormat::OSslEccPrivateCompressedBlob:
		{
			CngKey tmp = _self;
			key = ToKey(tmp);
			::EC_KEY_set_conv_form(key->pkey.ec, POINT_CONVERSION_COMPRESSED);
			r = tmp.Export(CngKeyBlobFormat::OSslEccPrivateBlob);
		}
		break;
	default:
		Throw(E_INVALIDARG);
	}
	return r;
}
开发者ID:sirmax1,项目名称:coin,代码行数:56,代码来源:ecdsa.cpp

示例4: SetData

void Blob::SetData(Blob &source) {
  if (data_)
    data_ = nullptr;
  shape_ = source.shape();
  count_ = num() * channels() * height() * width();
  data_ = source.data();
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:7,代码来源:blob.cpp

示例5: getOpenCVMat

Mat* MyImage::getOpenCVMat(){
  if(mat == NULL)  {
    try {
      Mat orig;
      getMagickImage();
      magick.magick("BGR");
      Blob blb ;
      magick.write(&blb);
      mat = new Mat();
      orig = Mat(magick.size().height(),
  	       magick.size().width(), 
  	       CV_8UC3, 
  	       (void *) blb.data());
      cvtColor(orig, *mat, CV_RGB2HSV);
      magick.magick("RGB");
    }
    catch (Magick::Exception &e)
    {
      cout << "Caught a magick exception: " << e.what() << endl;
      throw e;
    }
  }
  return mat;

}
开发者ID:varungupta181186,项目名称:vistool,代码行数:25,代码来源:myImage.cpp

示例6:

Blob::Blob(const Blob &source) {
  if (data_)
    data_ = nullptr;
  shape_ = source.shape();
  count_ = source.count();
  data_ = source.data();
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:7,代码来源:blob.cpp

示例7: setBlob

 void PreparedStatement::setBlob(int column, const Blob &value)
 {
     locker l(d->mutex);
     if (!d->prepared) {
         return;
     }
     sqlite3_bind_blob(d->stmt, column, value.data(), value.size(), SQLITE_STATIC);
 }
开发者ID:Morditux,项目名称:sqlpp,代码行数:8,代码来源:PreparedStatement.cpp

示例8: setBlob

    void setBlob(MYSQL_BIND& bind, unsigned long& length, const Blob& data)
    {
      length = data.size();
      reserve(bind, length);
      memcpy(static_cast<char*>(bind.buffer), data.data(), length);

      bind.buffer_type = MYSQL_TYPE_VAR_STRING;
      bind.is_null = 0;
      bind.length = &length;
    }
开发者ID:gema-arta,项目名称:zim-vendor,代码行数:10,代码来源:bindutils.cpp

示例9: verifySignature

bool RippleAddress::verifySignature(uint256 const& hash, Blob const& vchSig) const
{
    if (vchData.size() != crypto_sign_PUBLICKEYBYTES
        || vchSig.size () != crypto_sign_BYTES)
        throw std::runtime_error("bad inputs to verifySignature");

    bool verified = crypto_sign_verify_detached(vchSig.data(),
                 hash.data(), hash.bytes, vchData.data()) == 0;
    bool canonical = signatureIsCanonical (vchSig);
    return verified && canonical;
}
开发者ID:Payshares,项目名称:paysharesd,代码行数:11,代码来源:RippleAddress.cpp

示例10:

static
uint160 Hash160 (Blob const& vch)
{
    uint256 hash1;
    SHA256 (vch.data (), vch.size (), hash1.data ());

    uint160 hash2;
    RIPEMD160 (hash1.data (), hash1.size (), hash2.data ());

    return hash2;
}
开发者ID:CFQuantum,项目名称:CFQuantumd,代码行数:11,代码来源:RippleAddress.cpp

示例11: CryptoException

Blob
PrivateKey::sign(const Blob& data) const
{
    if (!key)
        throw CryptoException("Can't sign data: no private key set !");
    gnutls_datum_t sig;
    const gnutls_datum_t dat {(unsigned char*)data.data(), (unsigned)data.size()};
    if (gnutls_privkey_sign_data(key, GNUTLS_DIG_SHA512, 0, &dat, &sig) != GNUTLS_E_SUCCESS)
        throw CryptoException("Can't sign data !");
    Blob ret(sig.data, sig.data+sig.size);
    gnutls_free(sig.data);
    return ret;
}
开发者ID:mrobado,项目名称:opendht,代码行数:13,代码来源:crypto.cpp

示例12: prepare

 void prepare(svector<iovec>& v, void* ptr, const int sender=-1) {
     Task<Image> * task = (Task<Image> *) ptr;
     Blob* blob = task->getBlob();
     task->get()->magick("BMP");
     task->get()->write(blob);
     struct iovec iov={const_cast<void*>(blob->data()),blob->length()};
     v.push_back(iov);
     setCallbackArg(ptr);
     const char * imagename = task->name().c_str();
     struct iovec iov2={const_cast<char*>(imagename),strlen(imagename)+1};
     v.push_back(iov2);
     setCallbackArg(nullptr);
 }    
开发者ID:dido18,项目名称:SPMWorkspace,代码行数:13,代码来源:img_d.cpp

示例13:

bool Base58::decodeWithCheck (const char* psz, Blob& vchRet, Alphabet const& alphabet)
{
    if (!decode (psz, vchRet, alphabet))
        return false;

    auto size = vchRet.size ();

    if (size < 4)
    {
        vchRet.clear ();
        return false;
    }

    uint256 hash = SHA256Hash (vchRet.data (), vchRet.data () + size - 4);

    if (memcmp (&hash, &vchRet.end ()[-4], 4) != 0)
    {
        vchRet.clear ();
        return false;
    }

    vchRet.resize (size - 4);
    return true;
}
开发者ID:alexandrev,项目名称:rippled,代码行数:24,代码来源:Base58.cpp

示例14: fromString

	// create from a base58 encoded seed
	bool PaysharesPrivateKey::fromString(std::string& base58seed)
	{
		Blob vchTemp;
		Base58::decodeWithCheck(base58seed.c_str(), vchTemp, Base58::getRippleAlphabet());

		if (vchTemp.empty() &&
			vchTemp.size() == crypto_sign_SEEDBYTES + 1 &&
			vchTemp[0] == RippleAddress::VER_SEED)
		{
			return(false);
		}

		mSeed.resize(crypto_sign_SEEDBYTES);
		memcpy(&mSeed[0], vchTemp.data() + 1, crypto_sign_SEEDBYTES);
		mPair.setSeed(mSeed);
		return(true);
	}
开发者ID:Payshares,项目名称:paysharesd,代码行数:18,代码来源:PaysharesPrivateKey.cpp

示例15: createObject

NodeObject::Ptr DecodedBlob::createObject ()
{
    bassert (m_success);

    NodeObject::Ptr object;

    if (m_success)
    {
        Blob data (m_dataBytes);

        memcpy (data.data (), m_objectData, m_dataBytes);

        object = NodeObject::createObject (
            m_objectType, m_ledgerIndex, data, uint256::fromVoid (m_key));
    }

    return object;
}
开发者ID:Aiolossong,项目名称:rippled,代码行数:18,代码来源:DecodedBlob.cpp


注:本文中的Blob::data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。