这篇教程C++ BlockSize函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BlockSize函数的典型用法代码示例。如果您正苦于以下问题:C++ BlockSize函数的具体用法?C++ BlockSize怎么用?C++ BlockSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BlockSize函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: assertvoid CTR_ModePolicy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount){ assert(m_cipher->IsForwardTransformation()); // CTR mode needs the "encrypt" direction of the underlying block cipher, even to decrypt unsigned int maxBlocks = m_cipher->OptimalNumberOfParallelBlocks(); if (maxBlocks == 1) { unsigned int sizeIncrement = BlockSize(); while (iterationCount) { m_cipher->ProcessAndXorBlock(m_counterArray, input, output); IncrementCounterByOne(m_counterArray, sizeIncrement); output += sizeIncrement; input += sizeIncrement; iterationCount -= 1; } } else { unsigned int sizeIncrement = maxBlocks * BlockSize(); while (iterationCount >= maxBlocks) { ProcessMultipleBlocks(output, input, maxBlocks); output += sizeIncrement; input += sizeIncrement; iterationCount -= maxBlocks; } if (iterationCount > 0) ProcessMultipleBlocks(output, input, iterationCount); }}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:30,
示例2: Allocate//=========================================================================// Allocatevoid EpetraExt_BlockDiagMatrix::Allocate(){ int DataSize=0, NumBlocks=NumMyBlocks(); Pivots_=new int[NumMyUnknowns()]; int *ElementSize=new int[NumBlocks]; for(int i=0;i<NumBlocks;i++) { ElementSize[i]=BlockSize(i)*BlockSize(i); DataSize+=ElementSize[i]; } #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES if(Map().GlobalIndicesInt()) { DataMap_=new Epetra_BlockMap(-1,Map().NumMyElements(),Map().MyGlobalElements(),ElementSize,0,Map().Comm()); } else#endif#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES if(Map().GlobalIndicesLongLong()) { DataMap_=new Epetra_BlockMap((long long) -1,Map().NumMyElements(),Map().MyGlobalElements64(),ElementSize,0,Map().Comm()); } else#endif throw "EpetraExt_BlockDiagMatrix::Allocate: GlobalIndices type unknown"; Values_=new double[DataSize]; delete [] ElementSize;}
开发者ID:rorypeck,项目名称:trilinos,代码行数:30,
示例3: CheckHeapVOID CheckHeap(VOID){USHORT usSel;BYTE _huge * pHeapStart;BYTE _huge * pHeapEnd;BYTE _huge * pWork;ULONG ulTotal = 0; for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { pHeapStart = rgpSegment[usSel]; if (!pHeapStart) continue; pHeapEnd = pHeapStart + HEAP_SIZE; pWork = pHeapStart; while (pWork < pHeapEnd) { if (!IsBlockFree(pWork)) ulTotal += BlockSize(pWork); pWork += BlockSize(pWork) + sizeof (ULONG); } if (pWork != pHeapEnd) errmsg("Heap corruption found!"); } if (ulTotal != ulMem) { fflush(stdout); errmsg("Memory lost! %lu %lu %s", ulMem, ulTotal, szLast); }}
开发者ID:OS2World,项目名称:DRV-FAT32,代码行数:34,
示例4: BlockSizevoid CTR_ModePolicy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount){ unsigned int maxBlocks = m_cipher->OptimalNumberOfParallelBlocks(); if (maxBlocks == 1) { unsigned int sizeIncrement = BlockSize(); while (iterationCount) { m_cipher->ProcessAndXorBlock(m_counterArray, input, output); IncrementCounterByOne(m_counterArray, sizeIncrement); output += sizeIncrement; input += sizeIncrement; iterationCount -= 1; } } else { unsigned int sizeIncrement = maxBlocks * BlockSize(); while (iterationCount >= maxBlocks) { ProcessMultipleBlocks(output, input, maxBlocks); output += sizeIncrement; input += sizeIncrement; iterationCount -= maxBlocks; } if (iterationCount > 0) ProcessMultipleBlocks(output, input, iterationCount); }}
开发者ID:gogo40,项目名称:GoGo40-keygen,代码行数:29,
示例5: void CPaddingSSLv3::DoPadL(const TDesC8& aInput,TDes8& aOutput) { TInt paddingBytes=BlockSize()-(aInput.Length()%BlockSize()); aOutput.Append(aInput); aOutput.SetLength(aOutput.Length()+paddingBytes); for (TInt i=1;i<=paddingBytes;i++) { aOutput[aOutput.Length()-i]=(TUint8)(paddingBytes-1); } }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:10,
示例6: if//=========================================================================//! Computes the inverse / factorization if such is set on the listint EpetraExt_BlockDiagMatrix::Compute(){ int info; if(ApplyMode_==AM_MULTIPLY) // Multiply mode - noop return 0; else { // Factorization - Needed for both 'factor' and 'invert' modes int NumBlocks=NumMyBlocks(); for(int i=0;i<NumBlocks;i++){ int Nb=BlockSize(i); if(Nb==1) { // Optimize for Block Size 1 Values_[DataMap_->FirstPointInElement(i)]=1.0/Values_[DataMap_->FirstPointInElement(i)]; } else if(Nb==2) { // Optimize for Block Size 2 double * v=&Values_[DataMap_->FirstPointInElement(i)]; double d=1/(v[0]*v[3]-v[1]*v[2]); double v0old=v[0]; v[0]=v[3]*d; v[1]=-v[1]*d; v[2]=-v[2]*d; v[3]=v0old*d; } else{ // "Large" Block - Use LAPACK LAPACK.GETRF(Nb,Nb,&Values_[DataMap_->FirstPointInElement(i)],Nb,&Pivots_[Map().FirstPointInElement(i)],&info); if(info) EPETRA_CHK_ERR(-2); } } if(ApplyMode_==AM_INVERT){ // Invert - Use the factorization and invert the blocks in-place int lwork=3*DataMap_->MaxMyElementSize(); std::vector<double> work(lwork); for(int i=0;i<NumBlocks;i++){ int Nb=BlockSize(i); if(Nb==1 || Nb==2){ // Optimize for Block Size 1 and 2 // No need to do anything - factorization has already inverted the value } else{ // "Large" Block - Use LAPACK LAPACK.GETRI(Nb,&Values_[DataMap_->FirstPointInElement(i)],Nb,&Pivots_[Map().FirstPointInElement(i)],&work[0],&lwork,&info); if(info) EPETRA_CHK_ERR(-3); } } } } HasComputed_=true; return 0;}
开发者ID:rorypeck,项目名称:trilinos,代码行数:55,
示例7: CRYPTOPP_ASSERTvoid CBC_Encryption::ProcessData(byte *outString, const byte *inString, size_t length){ if (!length) return; CRYPTOPP_ASSERT(length%BlockSize()==0); unsigned int blockSize = BlockSize(); m_cipher->AdvancedProcessBlocks(inString, m_register, outString, blockSize, BlockTransformation::BT_XorInput); if (length > blockSize) m_cipher->AdvancedProcessBlocks(inString+blockSize, outString, outString+blockSize, length-blockSize, BlockTransformation::BT_XorInput); memcpy(m_register, outString + length - blockSize, blockSize);}
开发者ID:superbitcoin,项目名称:SuperBitcoin,代码行数:12,
示例8: PadLastBlockvoid TTMAC_Base::TruncatedFinal(byte *hash, size_t size){ PadLastBlock(BlockSize() - 2*sizeof(HashWordType)); CorrectEndianess(m_data, m_data, BlockSize() - 2*sizeof(HashWordType)); m_data[m_data.size()-2] = GetBitCountLo(); m_data[m_data.size()-1] = GetBitCountHi(); Transform(m_digest, m_data, true); word32 t2 = m_digest[2]; word32 t3 = m_digest[3]; if (size != DIGESTSIZE) { switch (size) { case 16: m_digest[3] += m_digest[1] + m_digest[4]; case 12: m_digest[2] += m_digest[0] + t3; case 8: m_digest[0] += m_digest[1] + t3; m_digest[1] += m_digest[4] + t2; break; case 4: m_digest[0] += m_digest[1] + m_digest[2] + m_digest[3] + m_digest[4]; break; case 0: // Used by HashTransformation::Restart() break; default: throw InvalidArgument("TTMAC_Base: can't truncate a Two-Track-MAC 20 byte digest to " + IntToString(size) + " bytes"); break; } } CorrectEndianess(m_digest, m_digest, size); memcpy(hash, m_digest, size); Restart(); // reinit for next use}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:50,
示例9: BlockSizeEXPORT_C void CPadding::PadL(const TDesC8& aInput, TDes8& aOutput) { // Check that the input is small enough to fit inside one padded block // Won't leave if input text is equal to blocksize. Let DoPadL handle such situations if(aInput.Length() > BlockSize() - MinPaddingLength() && aInput.Length() != BlockSize()) User::Leave(KErrArgument); // Check that the output descriptor supplied is large enough to store the result if(aOutput.MaxLength() < MaxPaddedLength(aInput.Length())) User::Leave(KErrOverflow); // Call the virtual function, implemented by derived classes DoPadL(aInput, aOutput); }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:15,
示例10: BlockSizevoid CTR_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv){ unsigned int s = BlockSize(); CopyOrZero(m_register, iv, s); m_counterArray.New(s * m_cipher->OptimalNumberOfParallelBlocks()); CopyOrZero(m_counterArray, iv, s);}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:7,
示例11: CheckHeapVOID CheckHeap(VOID){USHORT usSel;BYTE _huge * pHeapStart;BYTE _huge * pHeapEnd;BYTE _huge * pWork;USHORT rc; for (usSel = 0; usSel < MAX_SELECTORS; usSel++) { pHeapStart = rgpSegment[usSel]; if (!pHeapStart || pHeapStart == RESERVED_SEGMENT) continue; rc = MY_PROBEBUF(PB_OPREAD, (PBYTE)pHeapStart, HEAP_SIZE); if (rc) { CritMessage("FAT32: Protection VIOLATION in CheckHeap (SYS%d)", rc); Message("FAT32: Protection VIOLATION in CheckHeap (SYS%d)", rc); return; } pHeapEnd = pHeapStart + HEAP_SIZE; pWork = pHeapStart; while (pWork < pHeapEnd) pWork += BlockSize(pWork) + sizeof (ULONG); if (pWork != pHeapEnd) CritMessage("FAT32: Heap corruption found!"); }}
开发者ID:OS2World,项目名称:DRV-FAT32,代码行数:28,
示例12: BlockSizetemplate <class T, class BASE> byte * IteratedHashBase<T, BASE>::CreateUpdateSpace(size_t &size){ unsigned int blockSize = BlockSize(); unsigned int num = ModPowerOf2(m_countLo, blockSize); size = blockSize - num; return (byte *)m_data.begin() + num;}
开发者ID:hon1nbo,项目名称:BCTt,代码行数:7,
示例13: OnReadFileconst IStream* FileStorage::ReadFileHelper(const FileEntry& file, FileDataType dataType /*= FileDataType::Binary*/) const{ const IStream* resultStream = OnReadFile(file, dataType); RETURN_NULL_IF_NULL(resultStream); const CoderChain* coderChain = GetFileCoderChain(file); if (coderChain != nullptr) { if (IsWholeFileCoding()) { MemoryStream* tempStream = new MemoryStream(file.OriginalSize(), false); coderChain->Decode(*resultStream, *tempStream); const auto data = tempStream->CurrentBuffer(); SAFE_DELETE(tempStream); MemoryStream* outputStream = new MemoryStream(data); resultStream = outputStream; } else { resultStream = new BlockCodeReadStream(*resultStream, BlockSize(), *coderChain, file); } } return resultStream;}
开发者ID:johndpope,项目名称:Medusa,代码行数:25,
示例14: CRYPTOPP_UNUSEDvoid OFB_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length){ CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(length); CRYPTOPP_ASSERT(length == BlockSize()); CopyOrZero(m_register, iv, length);}
开发者ID:superbitcoin,项目名称:SuperBitcoin,代码行数:7,
示例15: OnWriteFileIStream* FileStorage::WriteFileHelper(FileEntry& file, FileOpenMode openMode /*= FileOpenMode::ReadOnly*/, FileDataType dataType /*= FileDataType::Binary*/){ IStream* resultStream = OnWriteFile(file, openMode, dataType);; const CoderChain* coderChain = GetFileCoderChain(file); if (coderChain != nullptr) { if (IsWholeFileCoding()) { resultStream = new FileCodeWriteStream(*resultStream, *coderChain, file); } else { resultStream = new BlockCodeWriteStream(*resultStream, BlockSize(), *coderChain, file); } } if (Hasher() != HasherType::None) { resultStream = new HashStream(*resultStream, Hasher(), [&file](StringRef result) {file.SetSignature(result); }); } return resultStream;}
开发者ID:johndpope,项目名称:Medusa,代码行数:25,
示例16: NotImplementedvoid CipherModeBase::GetNextIV(byte *IV){ if (!IsForwardTransformation()) throw NotImplemented("CipherModeBase: GetNextIV() must be called on an encryption object"); m_cipher->ProcessBlock(m_register); memcpy(IV, m_register, BlockSize());}
开发者ID:gogo40,项目名称:GoGo40-keygen,代码行数:8,
示例17: CRYPTOPP_UNUSEDvoid CTR_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length){ CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(length); assert(length == BlockSize()); CopyOrZero(m_register, iv, length); m_counterArray = m_register;}
开发者ID:BreakoutCoin,项目名称:Breakout-Chain-Client,代码行数:8,
示例18: custom_Block_Size/* ------------------------------------------------- * Tell the block index of the specified address * Default value : generated based on scatter file * -------------------------------------------------*/kal_uint32 custom_Block_Size(kal_uint32 nor_addr){ kal_uint32 blk_idx = 0; NOR_Flash_MTD_Data *mtdflash = (NOR_Flash_MTD_Data *)FlashDriveData.MTDData; blk_idx = BlockIndex((void *)mtdflash, nor_addr & (~((kal_uint32)mtdflash->BaseAddr))); return BlockSize((void *)mtdflash, blk_idx);}
开发者ID:WayWingsDev,项目名称:testmywatch,代码行数:13,
示例19: HashInputTooLongtemplate <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte *input, size_t len){ HashWordType oldCountLo = m_countLo, oldCountHi = m_countHi; if ((m_countLo = oldCountLo + HashWordType(len)) < oldCountLo) m_countHi++; // carry from low to high m_countHi += (HashWordType)SafeRightShift<8*sizeof(HashWordType)>(len); if (m_countHi < oldCountHi || SafeRightShift<2*8*sizeof(HashWordType)>(len) != 0) throw HashInputTooLong(this->AlgorithmName()); unsigned int blockSize = BlockSize(); unsigned int num = ModPowerOf2(oldCountLo, blockSize); if (num != 0) // process left over data { if ((num+len) >= blockSize) { memcpy((byte *)m_data.begin()+num, input, blockSize-num); HashBlock(m_data); input += (blockSize-num); len-=(blockSize - num); num=0; // drop through and do the rest } else { memcpy((byte *)m_data.begin()+num, input, len); return; } } // now process the input data in blocks of blockSize bytes and save the leftovers to m_data if (len >= blockSize) { if (input == (byte *)m_data.begin()) { assert(len == blockSize); HashBlock(m_data); return; } else if (IsAligned<T>(input)) { size_t leftOver = HashMultipleBlocks((T *)input, len); input += (len - leftOver); len = leftOver; } else do { // copy input first if it's not aligned correctly memcpy(m_data, input, blockSize); HashBlock(m_data); input+=blockSize; len-=blockSize; } while (len >= blockSize); } memcpy(m_data, input, len);}
开发者ID:hon1nbo,项目名称:BCTt,代码行数:57,
示例20: fLength/*! /brief Creates a new Allocator object.*/Allocator::Allocator(uint32 blockSize) : fLength(0) , fBlockSize(blockSize) , fBlockShift(0) , fInitStatus(B_NO_INIT){ status_t error = Udf::get_block_shift(BlockSize(), fBlockShift); if (!error) fInitStatus = B_OK;}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:12,
示例21: SeekToIterationvoid CTR_ModePolicy::SeekToIteration(lword iterationCount){ int carry=0; for (int i=BlockSize()-1; i>=0; i--) { unsigned int sum = m_register[i] + byte(iterationCount) + carry; m_counterArray[i] = (byte) sum; carry = sum >> 8; iterationCount >>= 8; }}
开发者ID:superbitcoin,项目名称:SuperBitcoin,代码行数:11,
示例22: assertvoid CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount){ assert(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt assert(m_feedbackSize == BlockSize()); unsigned int s = BlockSize(); if (dir == ENCRYPTION) { m_cipher->ProcessAndXorBlock(m_register, input, output); m_cipher->AdvancedProcessBlocks(output, input+s, output+s, (iterationCount-1)*s, 0); memcpy(m_register, output+(iterationCount-1)*s, s); } else { memcpy(m_temp, input+(iterationCount-1)*s, s); // make copy first in case of in-place decryption m_cipher->AdvancedProcessBlocks(input, input+s, output+s, (iterationCount-1)*s, BlockTransformation::BT_ReverseDirection); m_cipher->ProcessAndXorBlock(m_register, input, output); memcpy(m_register, m_temp, s); }}
开发者ID:brolee,项目名称:EMule-GIFC,代码行数:20,
示例23: SetIndexint LoopBlocking:: SetIndex( int num) { if (block_index > 1) { for ( ; num >=0; --num) { if (BlockSize( num) != 1) break; } if (num < 0) { block_index = 1; num = blocksize.size()-1; } } if (block_index <= 1) { for ( ; num >=0; num --) { if (BlockSize(num) == 1) break; } } return num; }
开发者ID:matzke1,项目名称:rose-develop,代码行数:20,
示例24: BlockSizevoid BlockTransformation::ProcessAndXorMultipleBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, unsigned int numberOfBlocks) const{ unsigned int blockSize = BlockSize(); while (numberOfBlocks--) { ProcessAndXorBlock(inBlocks, xorBlocks, outBlocks); inBlocks += blockSize; outBlocks += blockSize; if (xorBlocks) xorBlocks += blockSize; }}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:12,
注:本文中的BlockSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BloodColor函数代码示例 C++ BlockNumberIsValid函数代码示例 |