示例#1
0
 void HeapSort(InputContainer &container)
 {
     typename InputContainer::size_type end = container.size();
     typename InputContainer::size_type pos = end;
      HeapBuild(container , end);
     for (; pos >= 2; --pos){
         std::swap(container[0], container[pos - 1]);
         _MaxHeap(container, --end, 0);
     }
 }
示例#2
0
int checkHmac(const InputContainer& input, const KeyContainer& key, const std::string& expectedResult)
{
  std::string hash = hmac<HashMethod>(&input[0], input.size(), &key[0], key.size());
  if (hash == expectedResult)
    return 0;

  // error
  std::cerr << "hmac hash failed ! expected \"" << expectedResult << "\" but library computed \"" << hash << "\"" << std::endl;
  return 1;
}