9 #include <aws/cal/hash.h>
33 size_t truncateTo = 0) noexcept;
54 size_t truncateTo = 0) noexcept;
74 size_t truncateTo = 0) noexcept;
94 size_t truncateTo = 0) noexcept;
115 Hash &operator=(
const Hash &) =
delete;
122 operator bool()
const noexcept;
127 inline int LastError() const noexcept {
return m_lastError; }
153 bool Update(const
ByteCursor &toHash) noexcept;
162 bool Digest(
ByteBuf &output,
size_t truncateTo = 0) noexcept;
174 bool ComputeOneShot(const
ByteCursor &input,
ByteBuf &output,
size_t truncateTo = 0) noexcept;
180 size_t DigestSize() const noexcept;
183 Hash(aws_hash *hash) noexcept;
205 aws_hash *SeatForCInterop(
const std::shared_ptr<ByoHash> &selfRef);
215 virtual bool UpdateInternal(
const ByteCursor &toHash) noexcept = 0;
223 virtual bool DigestInternal(
ByteBuf &output,
size_t truncateTo = 0) noexcept = 0;
226 static void s_Destroy(
struct aws_hash *hash);
227 static int s_Update(
struct aws_hash *hash,
const struct aws_byte_cursor *buf);
228 static int s_Finalize(
struct aws_hash *hash,
struct aws_byte_buf *out);
230 static aws_hash_vtable s_Vtable;
231 aws_hash m_hashValue;
232 std::shared_ptr<ByoHash> m_selfReference;
bool AWS_CRT_CPP_API ComputeMD5(Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
Definition: Hash.cpp:56
#define AWS_CRT_CPP_API
Definition: Exports.h:36
std::function< std::shared_ptr< ByoHash >(size_t digestSize, Allocator *)> CreateHashCallback
Definition: Hash.h:235
int LastError() const noexcept
Definition: Hash.h:127
aws_byte_buf ByteBuf
Definition: Types.h:30
aws_allocator Allocator
Definition: Allocator.h:14
aws_byte_cursor ByteCursor
Definition: Types.h:31
static const size_t SHA256_DIGEST_SIZE
Definition: Hash.h:19
static const size_t SHA512_DIGEST_SIZE
Definition: Hash.h:20
static const size_t MD5_DIGEST_SIZE
Definition: Hash.h:21
bool AWS_CRT_CPP_API ComputeSHA256(Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
Definition: Hash.cpp:15
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition: Allocator.cpp:24
bool AWS_CRT_CPP_API ComputeSHA512(Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
Definition: Hash.cpp:30
static const size_t SHA1_DIGEST_SIZE
Definition: Hash.h:18
bool AWS_CRT_CPP_API ComputeSHA1(Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
Definition: Hash.cpp:45
Definition: Allocator.h:10