本文整理汇总了C++中CHash::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ CHash::Reset方法的具体用法?C++ CHash::Reset怎么用?C++ CHash::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHash
的用法示例。
在下文中一共展示了CHash::Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTestStepL
TVerdict CHmacIncrementalHmacWithResetStep::doTestStepL()
{
if (TestStepResult()==EPass)
{
//Assume faliure, unless all is successful
SetTestStepResult(EFail);
INFO_PRINTF1(_L("*** Hmac - Incremental Hash with Reset ***"));
INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
TVariantPtrC algorithmUid;
TVariantPtrC operationModeUid;
TPtrC sourcePath;
TPtrC expectedHash;
TPtrC encryptKey;
TVariantPtrC keyType;
//Extract the Test Case ID parameter from the specified INI file
if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
!GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationModeUid) ||
!GetStringFromConfig(ConfigSection(),KConfigSourcePath,sourcePath) ||
!GetStringFromConfig(ConfigSection(),KConfigExHashHmacValue,expectedHash) ||
!GetStringFromConfig(ConfigSection(),KConfigEncryptKey,encryptKey) ||
!GetStringFromConfig(ConfigSection(),KConfigEncryptKeyType,keyType))
{
ERR_PRINTF1(_L("** Error: Failed to Load Configuration Parameters **"));
SetTestStepResult(EFail);
}
else
{
//Create a pointer for the Hmac Implementation Object
CHash* hmacImpl = NULL;
//Convert encryption key to an 8 Bit Descriptor
HBufC8* keyStr = HBufC8::NewLC(encryptKey.Length());
TPtr8 keyStrPtr = keyStr->Des();
keyStrPtr.Copy(encryptKey);
//Create an new CryptoParams object to encapsulate the key type and secret key string
CCryptoParams* keyParams = CCryptoParams::NewL();
CleanupStack::PushL(keyParams);
keyParams->AddL(*keyStr,keyType);
//Create Key Object
TKeyProperty keyProperty;
CKey* key=CKey::NewL(keyProperty,*keyParams);
CleanupStack::PushL(key);
//Retrieve a Hmac Factory Object
TRAPD(err,CHashFactory::CreateHashL(hmacImpl,
algorithmUid,
operationModeUid,
key,
NULL));
if(hmacImpl && (err==KErrNone))
{
//Push the Hmac Implementation Object onto the Cleanup Stack
CleanupStack::PushL(hmacImpl);
RFs fsSession;
//Create a connection to the file server
err = fsSession.Connect();
if(err != KErrNone)
{
ERR_PRINTF2(_L("*** Error: File Server Connection - %d ***"), err);
SetTestStepResult(EFail);
}
else
{
RFile sourceFile;
CleanupClosePushL(sourceFile);
//Open the specified source file
err = sourceFile.Open(fsSession,sourcePath, EFileRead);
if(err != KErrNone)
{
ERR_PRINTF2(_L("*** Error: Opening Source File - %d ***"), err);
SetTestStepResult(EFail);
}
else
{
TInt sourceLength = 0;
TInt readPosition = 0;
TInt readIncrement = 0;
TBool hashComplete = EFalse;
TBool hashReset = EFalse;
TPtrC8 hashStr;
User::LeaveIfError(sourceFile.Size(sourceLength));
//Divide the file size into seperate incremental blocks to read
readIncrement = sourceLength/KDataReadBlocks;
//.........这里部分代码省略.........