2021-07-07 14:21:36 +02:00
|
|
|
#ifndef SHA256_H
|
|
|
|
#define SHA256_H
|
|
|
|
|
2021-11-01 19:16:43 +01:00
|
|
|
#include "core/string.h"
|
2021-07-07 14:21:36 +02:00
|
|
|
|
2021-08-22 21:06:47 +02:00
|
|
|
#include "core/reference.h"
|
|
|
|
|
|
|
|
class SHA256 : public Reference {
|
|
|
|
RCPP_OBJECT(SHA256, Reference);
|
|
|
|
|
2021-07-07 14:21:36 +02:00
|
|
|
public:
|
2021-11-01 19:16:43 +01:00
|
|
|
virtual String compute(const void *data, size_t num_bytes) = 0;
|
|
|
|
virtual String compute(const String &text) = 0;
|
2021-07-07 14:21:36 +02:00
|
|
|
|
|
|
|
virtual void add(const void *data, size_t num_bytes) = 0;
|
2021-11-01 19:16:43 +01:00
|
|
|
virtual String get_hash() = 0;
|
2021-07-07 14:21:36 +02:00
|
|
|
virtual void get_hash(unsigned char *buffer, size_t buffer_len) = 0;
|
|
|
|
|
|
|
|
virtual void reset() = 0;
|
|
|
|
|
2022-01-09 15:29:03 +01:00
|
|
|
static Ref<SHA256> get();
|
2021-07-07 14:21:36 +02:00
|
|
|
|
|
|
|
SHA256();
|
|
|
|
virtual ~SHA256();
|
|
|
|
|
|
|
|
protected:
|
2022-01-09 15:29:03 +01:00
|
|
|
static Ref<SHA256> (*_sha_256_creation_func)(void);
|
2021-07-07 14:21:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|