11 #ifndef __DECAF_SHA512_HXX__
12 #define __DECAF_SHA512_HXX__
15 #include <decaf/sha512.h>
16 #include <sys/types.h>
19 #if __cplusplus >= 201103L
20 #define DECAF_NOEXCEPT noexcept
22 #define DECAF_NOEXCEPT throw()
33 decaf_sha512_ctx_t wrapped;
47 inline SHA512() DECAF_NOEXCEPT { decaf_sha512_init(wrapped); }
50 inline void update(
const uint8_t *__restrict__ in,
size_t len) DECAF_NOEXCEPT { decaf_sha512_update(wrapped,in,len); }
64 decaf_sha512_final(wrapped,b.data(),b.size());
68 inline void reset() DECAF_NOEXCEPT { decaf_sha512_init(wrapped); }
74 decaf_sha512_final(wrapped,buffer.data(),len);
91 decaf_sha512_hash(buffer.data(),outlen,message.
data(),message.
size());
96 inline ~SHA512() DECAF_NOEXCEPT { decaf_sha512_destroy(wrapped); }
101 #undef DECAF_NOEXCEPT
A reference to a block of data, which (when accessed through this base class) is const.
Definition: secure_buffer.hxx:159
size_t size() const DECAF_NOEXCEPT
Get the size.
Definition: secure_buffer.hxx:208
const unsigned char * data() const DECAF_NOEXCEPT
Get const data.
Definition: secure_buffer.hxx:199
A reference to a writable block of data.
Definition: secure_buffer.hxx:270
An exception for when crypto (ie point decode) has failed.
Definition: secure_buffer.hxx:126
SHA512 wrapper function.
Definition: sha512.hxx:29
static SecureBuffer hash(const Block &message, size_t outlen=OUTPUT_BYTES)
Hash a message in one pass.
Definition: sha512.hxx:85
void reset() DECAF_NOEXCEPT
Resets the SHA context.
Definition: sha512.hxx:68
static const size_t DEFAULT_OUTPUT_BYTES
Default number of bytes to output.
Definition: sha512.hxx:44
void update(const uint8_t *__restrict__ in, size_t len) DECAF_NOEXCEPT
Add more data to running hash.
Definition: sha512.hxx:50
SHA512 & operator<<(const Block &s)
Add more data, stream version.
Definition: sha512.hxx:56
void update(const Block &s) DECAF_NOEXCEPT
Add more data to running hash, C++ version.
Definition: sha512.hxx:53
size_t max_output_size() const DECAF_NOEXCEPT
Return the sponge's maximum output size.
Definition: sha512.hxx:82
~SHA512() DECAF_NOEXCEPT
Destructor zeroizes state.
Definition: sha512.hxx:96
static const size_t OUTPUT_BYTES
Number of bytes ouf output.
Definition: sha512.hxx:38
size_t default_output_size() const DECAF_NOEXCEPT
Return the sponge's default output size.
Definition: sha512.hxx:79
static const size_t MAX_OUTPUT_BYTES
Number of bytes of output.
Definition: sha512.hxx:41
SHA512() DECAF_NOEXCEPT
Constructor.
Definition: sha512.hxx:47
SHA512 & operator+=(const Block &s)
Same as <<.
Definition: sha512.hxx:59
Namespace for all libdecaf C++ objects.
Definition: ed255.hxx:41
std::vector< unsigned char, SanitizingAllocator< unsigned char, 0 > > SecureBuffer
A variant of std::vector which securely zerozes its state when destructed.
Definition: secure_buffer.hxx:79
C++ self-zeroizing buffer.