SOL9 Sample: MAC

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * MAC.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


//2009/02/22

#include <sol/crypt/CryptServiceProvider.h>
#include <sol/crypt/KeyedMessageDigest.h>


int _tmain(int argc, TCHAR** argv)
{
  int rc = 0;
  if (argc != 2) {
    printf("Usage:MAC.exe filePath\n");
    return rc;
  }

  try {

    CryptServiceProvider csp;

    KeyedMessageDigest mac(csp, CALG_MAC);

    mac.hashFile(argv[1]);

    Bytes bytes;
    mac.getHashValue(bytes);
 
    printf("MAC:\n");
    bytes.dump();

  } catch (Exception& ex) {
    printf("Exception = %s\n", ex.getErrorMessage());
  }

  rc = GetLastError();

  return rc;
}

Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.