proxygen
Hmac.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 namespace fizz {
12 
16 class Hmac {
17  public:
18  virtual ~Hmac() = default;
19 
23  virtual size_t length() const = 0;
24 
28  virtual void hmac(
29  folly::ByteRange key,
30  const folly::IOBuf& in,
31  folly::MutableByteRange out) const = 0;
32 };
33 
34 template <typename Hash>
35 class HmacImpl : public Hmac {
36  public:
37  size_t length() const override {
38  return Hash::HashLen;
39  }
40 
41  void hmac(
42  folly::ByteRange key,
43  const folly::IOBuf& in,
44  folly::MutableByteRange out) const override {
45  return Hash::hmac(key, in, out);
46  }
47 }
48 } // namespace fizz
virtual void hmac(folly::ByteRange key, const folly::IOBuf &in, folly::MutableByteRange out) const =0
void hmac(folly::ByteRange key, const folly::IOBuf &in, folly::MutableByteRange out) const override
Definition: Hmac.h:41
virtual size_t length() const =0
size_t length() const override
Definition: Hmac.h:37
Definition: Actions.h:16
virtual ~Hmac()=default