本文整理汇总了C++中AsnBuf::hexDump方法的典型用法代码示例。如果您正苦于以下问题:C++ AsnBuf::hexDump方法的具体用法?C++ AsnBuf::hexDump怎么用?C++ AsnBuf::hexDump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsnBuf
的用法示例。
在下文中一共展示了AsnBuf::hexDump方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bittests
void bittests(void)
{
std::cout << "*** Start of AsnBits tests ***\n";
for (int index=0; gBitTestTable[index].input != NULL; index++)
{
AsnBits asnBits(gBitTestTable[index].input);
asnBits.UseNamedBitListRules(gBitTestTable[index].nblFlag);
AsnBuf expectedResult(&gBitTestTable[index].result[0],
DecTagLen((unsigned char *)gBitTestTable[index].result+1) + 2);
AsnBuf result;
AsnLen bytesEncoded;
std::cout << "AsnBits test " << index << " matches expected result? ";
try
{
asnBits.BEnc(result);
if (!(result == expectedResult))
{
std::string str;
int i;
int ch;
std::cout << "NO!\n";
std::cout << "FAILED!\n";
std::cout << "Expected Result: ";
expectedResult.hexDump(std::cout);
std::cout << "\n";
std::cout << "\nActual Result: ";
result.hexDump(std::cout);
std::cout << "\n";
}
else
{
std::cout << "YES!\n";
}
}
catch (SnaccException &e)
{
std::cout << "Encode FAILED: \n";
std::cout << "Error: " << e.what() << std::endl;
std::cout << "Stack:\n";
e.getCallStack(std::cout);
}
}
std::cout << "*** End of AsnBits tests ***\n";
}
示例2: TestSetSorting
void TestSetSorting(void)
{
int i = 0;
while (gSetSortingTable[i].input != NULL)
{
AsnLen bytesDecoded=0, bytesEncoded;
//TestSetSorting1 testSetSorting1;
int ch;
std::string input, result;
hex2str(gSetSortingTable[i].input, input);
hex2str(gSetSortingTable[i].derSorted, result);
std::stringstream ssInput(input);
std::stringstream ssResult(result);
AsnBuf inputBuf(ssInput);
AsnBuf expectedResultBuf(ssResult);
AsnBuf outputBuf;
inputBuf.ResetMode();
expectedResultBuf.ResetMode();
gSetSortingTable[i].asnType->BDec(inputBuf, bytesDecoded);
bytesEncoded = gSetSortingTable[i].asnType->BEnc(outputBuf);
if (bytesEncoded != bytesDecoded)
{
std::cout << "Encoded / Decode byte length mismatch!!!\n";
}
if (outputBuf == expectedResultBuf)
{
std::cout << "SET sorting SUCCESS!\n";
}
else
{
std::cout << "SET sorting FAILURE!\n";
std::string str;
std::cout << "Expected result: ";
expectedResultBuf.hexDump(std::cout);
std::cout << std::endl;
std::cout << "Actual result : ";
outputBuf.ResetMode();
outputBuf.hexDump(std::cout);
std::cout << std::endl;
}
i++;
}
multiCardSetTest();
}