BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlde::Sha384 Class Reference

#include <bdlde_sha2.h>

Public Member Functions

 Sha384 ()
 
 Sha384 (const void *data, bsl::size_t length)
 
void reset ()
 
void update (const void *data, bsl::size_t length)
 
void loadDigestAndReset (unsigned char *result)
 
void loadDigest (unsigned char *result) const
 Load the value of this SHA-2 digest into the specified result.
 
bsl::ostream & print (bsl::ostream &stream) const
 

Static Public Attributes

static const bsl::size_t k_DIGEST_SIZE = 384 / 8
 The size (in bytes) of the output.
 

Friends

bool operator== (const Sha384 &, const Sha384 &)
 

Detailed Description

This class represents a SHA-384 digest that can be updated as additional data is provided.

More generally, this class supports a complete set of value semantic operations, including copy construction, assignment, equality comparison, and ostream printing. (A precise operational definition of when two instances have the same value can be found in the description of operator== for the class.) This container is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing instance, the class is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.

See bdlde_sha2

Constructor & Destructor Documentation

◆ Sha384() [1/2]

bdlde::Sha384::Sha384 ( )

Construct a SHA-2 digest having the value corresponding to no data having been provided.

◆ Sha384() [2/2]

bdlde::Sha384::Sha384 ( const void *  data,
bsl::size_t  length 
)

Construct a SHA-2 digest corresponding to the specified data having the specified length (in bytes). Note that if data is 0, then length also must be 0.

Member Function Documentation

◆ loadDigest()

void bdlde::Sha384::loadDigest ( unsigned char *  result) const

◆ loadDigestAndReset()

void bdlde::Sha384::loadDigestAndReset ( unsigned char *  result)

Load the current value of this SHA-2 digest into the specified result and set the value of this SHA-2 digest to the value provided by the default constructor.

◆ print()

bsl::ostream & bdlde::Sha384::print ( bsl::ostream &  stream) const

Format the current value of this SHA-2 digest to the specified output stream and return a reference to the modifiable stream.

◆ reset()

void bdlde::Sha384::reset ( )

Reset the value of this SHA-2 digest to the value provided by the default constructor.

◆ update()

void bdlde::Sha384::update ( const void *  data,
bsl::size_t  length 
)

Update the value of this SHA-2 digest to incorporate the specified data having the specified length in bytes. If the current state is the default state, the resultant value of this SHA-2 digest is the application of the SHA-2 algorithm upon the currently given data of the given length. If this digest has been previously provided data and has not been subsequently reset, the current state is not the default state and the resultant value is equivalent to applying the SHA-2 algorithm upon the concatenation of all the provided data. The behavior is undefined unless the range [data, data + length) is a valid range. Note that if data is 0, then length must also be 0.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const Sha384 ,
const Sha384  
)
friend

Return true if the specified lhs and rhs SHA digests have the same value, and false otherwise. Two digests have the same value if, after applying any number of equivalent updates to both (possibly including no updates), the values obtained from their respective loadDigest methods are identical.

Member Data Documentation

◆ k_DIGEST_SIZE

const bsl::size_t bdlde::Sha384::k_DIGEST_SIZE = 384 / 8
static

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