void BufferPtr::CopyFrom (const ConstBufferPtr &bufferPtr) const { if (bufferPtr.Size() > DataSize) throw ParameterTooLarge (SRC_POS); Memory::Copy (DataPtr, bufferPtr.Get(), bufferPtr.Size()); }
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)); }
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; }
void Buffer::CopyFrom (const ConstBufferPtr &bufferPtr) { if (!IsAllocated ()) Allocate (bufferPtr.Size()); else if (bufferPtr.Size() > DataSize) throw ParameterTooLarge (SRC_POS); Memory::Copy (DataPtr, bufferPtr.Get(), bufferPtr.Size()); }
void Sha256::ProcessData (const ConstBufferPtr &data) { if_debug (ValidateDataParameters (data)); sha256_hash (data.Get(), (int) data.Size(), (sha256_ctx *) Context.Ptr()); }
void Ripemd160::ProcessData (const ConstBufferPtr &data) { if_debug (ValidateDataParameters (data)); RMD160Update ((RMD160_CTX *) Context.Ptr(), data.Get(), (int) data.Size()); }
void Whirlpool::ProcessData (const ConstBufferPtr &data) { if_debug (ValidateDataParameters (data)); WHIRLPOOL_add (data.Get(), (int) data.Size() * 8, (WHIRLPOOL_CTX *) Context.Ptr()); }