AWS IoT Device SDK C++ v2: Aws::Crt::Crypto::Hash Class Reference

AWS IoT Device SDK C++ v2 1.14.0 AWS IoT Device SDK C++ v2

Public Member Functions | Static Public Member Functions | List of all members
Aws::Crt::Crypto::Hash Class Referencefinal

`#include <Hash.h>`

## Public Member Functions
| ~Hash ()
| Hash (const Hash &)=delete
Hash & | operator= (const Hash &)=delete
| Hash (Hash &&toMove)
Hash & | operator= (Hash &&toMove)
| operator bool () const noexcept
int | LastError () const noexcept
bool | Update (const ByteCursor &toHash) noexcept
bool | Digest (ByteBuf &output, size_t truncateTo=0) noexcept

## Static Public Member Functions
static Hash | CreateSHA256 (Allocator *allocator=g_allocator) noexcept
static Hash | CreateMD5 (Allocator *allocator=g_allocator) noexcept

## Detailed Description

Streaming Hash object. The typical use case is for computing the hash of an object that is too large to load into memory. You can call Update() multiple times as you load chunks of data into memory. When you're finished simply call Digest(). After Digest() is called, this object is no longer usable.

## Constructor & Destructor Documentation

## ◆ ~Hash()

Aws::Crt::Crypto::Hash::~Hash | ( |  | ) |

## ◆ Hash() [1/2]

Aws::Crt::Crypto::Hash::Hash | ( | const Hash & |  | ) |
| delete

## ◆ Hash() [2/2]

Aws::Crt::Crypto::Hash::Hash | ( | Hash && | toMove | ) |

## Member Function Documentation

## ◆ CreateMD5()

Hash Aws::Crt::Crypto::Hash::CreateMD5 | ( | Allocator * | allocator = `g_allocator` | ) |
| staticnoexcept

Creates an instance of a Streaming MD5 Hash.

## ◆ CreateSHA256()

Hash Aws::Crt::Crypto::Hash::CreateSHA256 | ( | Allocator * | allocator = `g_allocator` | ) |
| staticnoexcept

Creates an instance of a Streaming SHA256 Hash.

## ◆ Digest()

bool Aws::Crt::Crypto::Hash::Digest | ( | ByteBuf & | output,
|  | size_t | truncateTo = `0`
| ) |  |
| noexcept

Finishes the running hash operation and writes the digest into output. The available capacity of output must be large enough for the digest. See: SHA256_DIGEST_SIZE and MD5_DIGEST_SIZE for size hints. 'truncateTo' is for if you want truncated output (e.g. you only want the first 16 bytes of a SHA256 digest. Returns true on success. Call LastError() for the reason this call failed.

## ◆ LastError()

int Aws::Crt::Crypto::Hash::LastError | ( |  | ) | const
| inlinenoexcept

Returns the value of the last aws error encountered by operations on this instance.

## ◆ operator bool()

Aws::Crt::Crypto::Hash::operator bool | ( |  | ) | const
| inlinenoexcept

Returns true if the instance is in a valid state, false otherwise.

## ◆ operator=() [1/2]

Hash & Aws::Crt::Crypto::Hash::operator= | ( | const Hash & |  | ) |
| delete

## ◆ operator=() [2/2]

Hash & Aws::Crt::Crypto::Hash::operator= | ( | Hash && | toMove | ) |

## ◆ Update()

bool Aws::Crt::Crypto::Hash::Update | ( | const ByteCursor & | toHash | ) |
| noexcept

Updates the running hash object with data in toHash. Returns true on success. Call LastError() for the reason this call failed.

The documentation for this class was generated from the following files:

- crt/aws-crt-cpp/include/aws/crt/crypto/Hash.h
- crt/aws-crt-cpp/source/crypto/Hash.cpp