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


C++ ConstBufferPtr::Size方法代码示例

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


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

示例1: CopyFrom

	void BufferPtr::CopyFrom (const ConstBufferPtr &bufferPtr) const
	{
		if (bufferPtr.Size() > DataSize)
			throw ParameterTooLarge (SRC_POS);

		Memory::Copy (DataPtr, bufferPtr.Get(), bufferPtr.Size());
	}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:7,代码来源:Buffer.cpp

示例2: WriteAt

void File::WriteAt (const ConstBufferPtr &buffer, uint64 position) const
{
    if_debug (ValidateState());

#ifdef TC_TRACE_FILE_OPERATIONS
    TraceFileOperation (FileHandle, Path, true, buffer.Size(), position);
#endif
    throw_sys_sub_if (pwrite (FileHandle, buffer, buffer.Size(), position) != (ssize_t) buffer.Size(), wstring (Path));
}
开发者ID:Clockwork-Sphinx,项目名称:VeraCrypt,代码行数:9,代码来源:File.cpp

示例3: Read

	uint64 MemoryStream::Read (const BufferPtr &buffer)
	{
		if (Data.size() == 0)
			throw ParameterIncorrect (SRC_POS);

		ConstBufferPtr streamBuf (*this);
		size_t len = buffer.Size();
		if (streamBuf.Size() - ReadPosition < len)
			len = streamBuf.Size() - ReadPosition;

		BufferPtr(buffer).CopyFrom (streamBuf.GetRange (ReadPosition, len));
		ReadPosition += len;
		return len;
	}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:14,代码来源:MemoryStream.cpp

示例4: DeserializeEntryAt

	T VolumeHeader::DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const
	{
		if (offset > header.Size())
			throw ParameterIncorrect (SRC_POS);

		return Endian::Big (*reinterpret_cast<const T *> (header.Get() + offset));
	}
开发者ID:AB9IL,项目名称:VeraCrypt,代码行数:7,代码来源:VolumeHeader.cpp

示例5: EncryptNew

	void VolumeHeader::EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf)
	{
		if (newHeaderBuffer.Size() != HeaderSize || newSalt.Size() != SaltSize)
			throw ParameterIncorrect (SRC_POS);

		shared_ptr <EncryptionMode> mode = EA->GetMode()->GetNew();
		shared_ptr <EncryptionAlgorithm> ea = EA->GetNew();

		if (typeid (*mode) == typeid (EncryptionModeXTS))
		{
			mode->SetKey (newHeaderKey.GetRange (EA->GetKeySize(), EA->GetKeySize()));
			ea->SetKey (newHeaderKey.GetRange (0, ea->GetKeySize()));
		}
		else
		{
			mode->SetKey (newHeaderKey.GetRange (0, mode->GetKeySize()));
			ea->SetKey (newHeaderKey.GetRange (LegacyEncryptionModeKeyAreaSize, ea->GetKeySize()));
		}

		ea->SetMode (mode);

		newHeaderBuffer.CopyFrom (newSalt);

		BufferPtr headerData = newHeaderBuffer.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize);
		Serialize (headerData);
		ea->Encrypt (headerData);

		if (newPkcs5Kdf)
			Pkcs5 = newPkcs5Kdf;
	}
开发者ID:AB9IL,项目名称:VeraCrypt,代码行数:30,代码来源:VolumeHeader.cpp

示例6: Serialize

	void Serializer::Serialize (const string &name, const ConstBufferPtr &data)
	{
		SerializeString (name);

		uint64 size = data.Size();
		Serialize (size);

		DataStream->Write (data);
	}
开发者ID:4nt1m0n,项目名称:truecrypt,代码行数:9,代码来源:Serializer.cpp

示例7: SetKey

	void Cipher::SetKey (const ConstBufferPtr &key)
	{
		if (key.Size() != GetKeySize ())
			throw ParameterIncorrect (SRC_POS);

		if (!Initialized)
			ScheduledKey.Allocate (GetScheduledKeySize ());

		SetCipherKey (key);
		Key.CopyFrom (key);
		Initialized = true;
	}
开发者ID:wyrover,项目名称:VeraCrypt,代码行数:12,代码来源:Cipher.cpp

示例8: SetKey

	void EncryptionAlgorithm::SetKey (const ConstBufferPtr &key)
	{
		if (Ciphers.size() < 1)
			throw NotInitialized (SRC_POS);

		if (GetKeySize() != key.Size())
			throw ParameterIncorrect (SRC_POS);

		size_t keyOffset = 0;
		foreach_ref (Cipher &c, Ciphers)
		{
			c.SetKey (key.GetRange (keyOffset, c.GetKeySize()));
			keyOffset += c.GetKeySize();
		}
开发者ID:josejamilena,项目名称:veracrypt,代码行数:14,代码来源:EncryptionAlgorithm.cpp

示例9: SetKey

	void EncryptionModeLRW::SetKey (const ConstBufferPtr &key)
	{
		if (key.Size() != 16)
			throw ParameterIncorrect (SRC_POS);

		if (!KeySet)
			GfContext.Allocate (sizeof (GfCtx));

		if (!Gf64TabInit ((unsigned char *) key.Get(), (GfCtx *) (GfContext.Ptr())))
			throw bad_alloc();

		if (!Gf128Tab64Init ((unsigned char *) key.Get(), (GfCtx *) (GfContext.Ptr())))
			throw bad_alloc();

		Key.CopyFrom (key);
		KeySet = true;
	}
开发者ID:BlueBlock,项目名称:truecrypt,代码行数:17,代码来源:EncryptionModeLRW.cpp

示例10: ShowBytes

	void RandomPoolEnrichmentDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer)
	{
		wxString str;

		for (size_t i = 0; i < buffer.Size(); ++i)
		{
			str += wxString::Format (L"%02X", buffer[i]);
		}

		str += L"..";

		textCtrl->SetLabel (str.c_str());

		for (size_t i = 0; i < str.size(); ++i)
		{
			str[i] = L'X';
		}
	}
开发者ID:ArtisR,项目名称:TrueCrypt,代码行数:18,代码来源:RandomPoolEnrichmentDialog.cpp

示例11: ShowBytes

	void VolumeCreationProgressWizardPage::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots)
	{
		wxString str;

		for (size_t i = 0; i < MaxDisplayedKeyBytes && i < buffer.Size(); ++i)
		{
			str += wxString::Format (L"%02X", buffer[i]);
		}

		if (appendDots)
			str += L"..";

		textCtrl->SetLabel (str.c_str());

		for (size_t i = 0; i < str.size(); ++i)
		{
			str[i] = L'X';
		}
	}
开发者ID:CSRedRat,项目名称:CipherShed,代码行数:19,代码来源:VolumeCreationProgressWizardPage.cpp

示例12: ShowBytes

	void KeyfileGeneratorDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots)
	{
		wxString str;

		for (size_t i = 0; i < buffer.Size(); ++i)
		{
			str += wxString::Format (L"%02X", buffer[i]);
		}

		if (appendDots)
			str += L"..";

		textCtrl->SetLabel (str.c_str());

		for (size_t i = 0; i < str.size(); ++i)
		{
			str[i] = L'X';
		}
	}
开发者ID:josejamilena,项目名称:veracrypt,代码行数:19,代码来源:KeyfileGeneratorDialog.cpp

示例13: lock

	shared_ptr <Buffer> FuseService::GetVolumeInfo ()
	{
		shared_ptr <Stream> stream (new MemoryStream);

		{
			ScopeLock lock (OpenVolumeInfoMutex);

			OpenVolumeInfo.Set (*MountedVolume);
			OpenVolumeInfo.SlotNumber = SlotNumber;

			OpenVolumeInfo.Serialize (stream);
		}

		ConstBufferPtr infoBuf = dynamic_cast <MemoryStream&> (*stream);
		shared_ptr <Buffer> outBuf (new Buffer (infoBuf.Size()));
		outBuf->CopyFrom (infoBuf);

		return outBuf;
	}
开发者ID:anjo0722,项目名称:CipherShed,代码行数:19,代码来源:FuseService.cpp

示例14: Write

	void MemoryStream::Write (const ConstBufferPtr &data)
	{
		for (uint64 i = 0; i < data.Size(); i++)
			Data.push_back (data[i]);
	}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:5,代码来源:MemoryStream.cpp

示例15: Set

	void VolumePassword::Set (const ConstBufferPtr &password)
	{
		Set (password, password.Size());
	}
开发者ID:cocoon,项目名称:VeraCrypt,代码行数:4,代码来源:VolumePassword.cpp


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