本文整理汇总了C++中CHash::SetOperationModeL方法的典型用法代码示例。如果您正苦于以下问题:C++ CHash::SetOperationModeL方法的具体用法?C++ CHash::SetOperationModeL怎么用?C++ CHash::SetOperationModeL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHash
的用法示例。
在下文中一共展示了CHash::SetOperationModeL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTestStepL
//.........这里部分代码省略.........
//Retrieve the final 8bit hash value and convert to 16bit
HBufC* hashDataA = HBufC::NewLC(hashSize);
TPtr hashPtrA = hashDataA->Des();
hashPtrA.Copy(hashHmacImpl->Hash(*sourceData));
//Take the 16bit descriptor and convert the string to hexadecimal
TVariantPtrC convertHash;
convertHash.Set(hashPtrA);
HBufC* resultA = convertHash.HexStringLC();
INFO_PRINTF2(_L("*** Hashed Data: %S ***"),&*resultA);
INFO_PRINTF2(_L("*** Expected Hash: %S ***"),&expectedHash);
if(*resultA == expectedHash)
{
INFO_PRINTF1(_L("*** PRIMARY HASH VALID - STAGE 1 PASS ***"));
//Set the valid key within the Hmac Implementation Object
TRAP(err,hashHmacImpl->SetKeyL(*key));
if(err!=KErrNone)
{
ERR_PRINTF2(_L("*** ERROR %d: Setting Key ***"),err);
User::Leave(err);
}
else
{
INFO_PRINTF1(_L("*** HMAC KEY SET ***"));
}
//Set the Operation Mode of the Hmac Implementation Object
hashHmacImpl->SetOperationModeL(secondOperationModeUid);
if(err!=KErrNone)
{
ERR_PRINTF3(_L("*** ERROR %d: Setting Operation Mode %S ***"),err,&secondOperationModeUid);
User::Leave(err);
}
else
{
INFO_PRINTF2(_L("*** OPERATION MODE SET : %S ***"),&secondOperationModeUid);
}
//Create a NULL TCharacteristics pointer
const TCharacteristics* charsPtrB(NULL);
//Retrieve the characteristics for the hash implementation object
TRAP_LOG(err, hashHmacImpl->GetCharacteristicsL(charsPtrB));
//Static cast the characteristics to type THashCharacteristics
const THashCharacteristics* hashCharsPtrB = static_cast<const THashCharacteristics*>(charsPtrB);
//The hash output size is returned in Bits, divide by 8 to get the Byte size
hashSize = hashCharsPtrB->iOutputSize/8;
//Retrieve the final 8bit hash value and convert to 16bit
HBufC* hashDataB = HBufC::NewLC(hashSize);
TPtr hashPtrB = hashDataB->Des();
hashPtrB.Copy(hashHmacImpl->Hash(*sourceData));
//Take the 16bit descriptor and convert the string to hexadecimal
convertHash.Set(hashPtrB);
HBufC* resultB = convertHash.HexStringLC();