Botan  1.11.15
src/lib/mac/mac.cpp
Go to the documentation of this file.
00001 /*
00002 * Message Authentication Code base class
00003 * (C) 1999-2008 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #include <botan/mac.h>
00009 #include <botan/mem_ops.h>
00010 
00011 namespace Botan {
00012 
00013 /*
00014 * Default (deterministic) MAC verification operation
00015 */
00016 bool MessageAuthenticationCode::verify_mac(const byte mac[], size_t length)
00017    {
00018    secure_vector<byte> our_mac = final();
00019 
00020    if(our_mac.size() != length)
00021       return false;
00022 
00023    return same_mem(&our_mac[0], &mac[0], length);
00024    }
00025 
00026 }