Files

47 lines
1.3 KiB
C++
Raw Permalink Normal View History

2017-11-09 19:34:51 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2014 The Bitcoin Core developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2014-10-26 01:38:13 -07:00
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_CRYPTO_HMAC_SHA256_H
#define FLOWEE_CRYPTO_HMAC_SHA256_H
2014-10-26 01:38:13 -07:00
2018-02-10 16:57:46 +01:00
#include "sha256.h"
2014-10-26 01:38:13 -07:00
#include <cstdint>
#include <cstdlib>
2014-10-26 01:38:13 -07:00
/** A hasher class for HMAC-SHA-512. */
class CHMAC_SHA256
{
private:
CSHA256 outer;
CSHA256 inner;
public:
static const size_t OUTPUT_SIZE = 32;
CHMAC_SHA256(const unsigned char* key, size_t keylen);
CHMAC_SHA256& write(const unsigned char* data, size_t len)
2014-10-26 01:38:13 -07:00
{
inner.write(data, len);
2014-10-26 01:38:13 -07:00
return *this;
}
void finalize(unsigned char hash[OUTPUT_SIZE]);
2014-10-26 01:38:13 -07:00
};
2018-01-16 10:47:52 +00:00
#endif