supla-device
Loading...
Searching...
No Matches
sha256.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_SHA256_H_
5#define SRC_SUPLA_SHA256_H_
6
7#include <stdint.h>
8
9/*
10 * Simple platform SHA256 wrapper without exposing platform-specific types.
11 */
12
13namespace Supla {
14
15class Sha256 {
16 public:
17 Sha256();
18 ~Sha256();
19 void update(const uint8_t *data, const int size);
20 void digest(uint8_t *output, int length = 32);
21
22 protected:
23#ifndef SUPLA_TEST
24 void *ctx;
25#else
26 uint8_t state[32];
27 uint32_t offset;
28#endif
29};
30
31}; // namespace Supla
32
33#endif // SRC_SUPLA_SHA256_H_
Definition sha256.h:15