2019-11-04 09:55:43 -05:00
|
|
|
#ifndef SHA2_NATIVE_HH
|
|
|
|
#define SHA2_NATIVE_HH
|
2012-12-29 08:07:46 -05:00
|
|
|
|
|
|
|
#include <sph/sph_sha2.h>
|
2019-11-04 09:55:43 -05:00
|
|
|
#include <string>
|
2012-12-29 08:07:46 -05:00
|
|
|
|
2019-11-04 09:55:43 -05:00
|
|
|
class SHA2_native
|
2012-12-29 08:07:46 -05:00
|
|
|
{
|
|
|
|
public:
|
2019-11-04 09:55:43 -05:00
|
|
|
SHA2_native(int bits);
|
|
|
|
~SHA2_native() = default;
|
|
|
|
void update(unsigned char const* const, size_t);
|
|
|
|
void finalize();
|
2012-12-29 08:07:46 -05:00
|
|
|
std::string getRawDigest();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void badBits();
|
|
|
|
|
|
|
|
int bits;
|
|
|
|
sph_sha256_context ctx256;
|
|
|
|
sph_sha384_context ctx384;
|
|
|
|
sph_sha512_context ctx512;
|
|
|
|
unsigned char sha256sum[32];
|
|
|
|
unsigned char sha384sum[48];
|
|
|
|
unsigned char sha512sum[64];
|
|
|
|
};
|
|
|
|
|
2019-11-04 09:55:43 -05:00
|
|
|
#endif // SHA2_NATIVE_HH
|