monotone

monotone Mtn Source Tree

Root/src/hmac.hh

1// Copyright (C) 2005 Matt Johnston <matt@ucc.asn.au>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#ifndef __HMAC_HH__
11#define __HMAC_HH__
12
13#include <botan/botan.h>
14
15#include "vocab.hh"
16#include "constants.hh"
17#include "string_queue.hh"
18
19struct chained_hmac
20{
21public:
22 chained_hmac(netsync_session_key const & session_key, bool active);
23 void set_key(netsync_session_key const & session_key);
24 std::string process(std::string const & str, size_t pos = 0,
25 size_t n = std::string::npos);
26 std::string process(string_queue const & str, size_t pos = 0,
27 size_t n = std::string::npos);
28
29 size_t const hmac_length;
30 bool is_active() { return active; }
31
32private:
33 bool active;
34 Botan::SymmetricKey key;
35 Botan::Pipe engine;
36 std::string chain_val;
37};
38
39#endif // __HMAC_HH__
40
41// Local Variables:
42// mode: C++
43// fill-column: 76
44// c-file-style: "gnu"
45// indent-tabs-mode: nil
46// End:
47// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status