BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlde_sha2.h
Go to the documentation of this file.
1/// @file bdlde_sha2.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlde_sha2.h -*-C++-*-
8#ifndef INCLUDED_BDLDE_SHA2
9#define INCLUDED_BDLDE_SHA2
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id$ $CSID$")
13
14/// @defgroup bdlde_sha2 bdlde_sha2
15/// @brief Provide a value-semantic type encoding a message in a SHA-2 digest.
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlde
19/// @{
20/// @addtogroup bdlde_sha2
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlde_sha2-purpose"> Purpose</a>
25/// * <a href="#bdlde_sha2-classes"> Classes </a>
26/// * <a href="#bdlde_sha2-description"> Description </a>
27/// * <a href="#bdlde_sha2-usage"> Usage </a>
28/// * <a href="#bdlde_sha2-example-1-basic-usage"> Example 1: Basic Usage </a>
29///
30/// # Purpose {#bdlde_sha2-purpose}
31/// Provide a value-semantic type encoding a message in a SHA-2 digest.
32///
33/// # Classes {#bdlde_sha2-classes}
34///
35/// - bdlde::Sha224: value-semantic type representing a SHA-224 digest
36/// - bdlde::Sha256: value-semantic type representing a SHA-256 digest
37/// - bdlde::Sha384: value-semantic type representing a SHA-384 digest
38/// - bdlde::Sha512: value-semantic type representing a SHA-512 digest
39///
40/// @see bdlde_md5
41///
42/// # Description {#bdlde_sha2-description}
43/// This component provides a set of classes (`Sha224`, `Sha256`,
44/// `Sha384`, and `Sha512`) that implement a mechanism for computing and
45/// updating a SHA-2 digest (a cryptographic hash). The specification for this
46/// is based on FIPS-180, which can be found at
47/// @code
48/// http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
49/// @endcode
50///
51/// Note that a SHA-2 digest does not aid in error correction.
52///
53/// ## Usage {#bdlde_sha2-usage}
54///
55///
56/// This section illustrates intended use of this component.
57///
58/// ### Example 1: Basic Usage {#bdlde_sha2-example-1-basic-usage}
59///
60///
61/// The `validatePassword` function below returns whether a specified password
62/// has a specified hash value. The `assertPasswordIsExpected` function below
63/// has a sample password to hash and a hash value that matches it. Note that
64/// the output of `loadDigest` is a binary representation. When hashes are
65/// displayed for human consumption, they are typically converted to hex, but
66/// that would create unnecessary overhead here.
67/// @code
68/// /// Return `true` if the specified `password` concatenated with the
69/// /// specified `salt` has a SHA-512 hash equal to the specified
70/// /// `expected`, and `false` otherwise.
71/// bool validatePassword(const bsl::string& password,
72/// const bsl::string& salt,
73/// const unsigned char *expected)
74/// {
75/// bdlde::Sha512 hasher;
76/// hasher.update(password.c_str(), password.length());
77/// hasher.update(salt.c_str(), salt.length());
78///
79/// unsigned char digest[bdlde::Sha512::k_DIGEST_SIZE];
80/// hasher.loadDigest(digest);
81///
82/// return bsl::equal(digest,
83/// digest + bdlde::Sha512::k_DIGEST_SIZE,
84/// expected);
85/// }
86///
87/// /// Asserts that the constant string `pass` salted with `word` has the
88/// /// expected hash value. In a real application, the expected hash would
89/// /// likely come from some sort of database.
90/// void assertPasswordIsExpected()
91/// {
92/// const bsl::string password = "pass";
93/// const bsl::string salt = "word";
94/// const unsigned char expected[bdlde::Sha512::k_DIGEST_SIZE] = {
95/// 0xB1, 0x09, 0xF3, 0xBB, 0xBC, 0x24, 0x4E, 0xB8, 0x24, 0x41, 0x91,
96/// 0x7E, 0xD0, 0x6D, 0x61, 0x8B, 0x90, 0x08, 0xDD, 0x09, 0xB3, 0xBE,
97/// 0xFD, 0x1B, 0x5E, 0x07, 0x39, 0x4C, 0x70, 0x6A, 0x8B, 0xB9, 0x80,
98/// 0xB1, 0xD7, 0x78, 0x5E, 0x59, 0x76, 0xEC, 0x04, 0x9B, 0x46, 0xDF,
99/// 0x5F, 0x13, 0x26, 0xAF, 0x5A, 0x2E, 0xA6, 0xD1, 0x03, 0xFD, 0x07,
100/// 0xC9, 0x53, 0x85, 0xFF, 0xAB, 0x0C, 0xAC, 0xBC, 0x86
101/// };
102///
103/// ASSERT(validatePassword(password, salt, expected));
104/// }
105/// @endcode
106/// @}
107/** @} */
108/** @} */
109
110/** @addtogroup bdl
111 * @{
112 */
113/** @addtogroup bdlde
114 * @{
115 */
116/** @addtogroup bdlde_sha2
117 * @{
118 */
119
120#include <bdlscm_version.h>
121
122#include <bsl_cstddef.h>
123#include <bsl_cstdint.h>
124#include <bsl_iosfwd.h>
125
126
127namespace bdlde {
128
129 // ============
130 // class Sha224
131 // ============
132
133/// This `class` represents a SHA-224 digest that can be updated as
134/// additional data is provided.
135///
136/// More generally, this class supports a complete set of *value*
137/// *semantic* operations, including copy construction, assignment, equality
138/// comparison, and `ostream` printing. (A precise operational definition
139/// of when two instances have the same value can be found in the
140/// description of `operator==` for the class.) This container is
141/// *exception* *neutral* with no guarantee of rollback: if an exception is
142/// thrown during the invocation of a method on a pre-existing instance, the
143/// class is left in a valid state, but its value is undefined. In no event
144/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
145/// object as both source and destination) is supported in all cases.
146///
147/// See @ref bdlde_sha2
148class Sha224 {
149
150 // DATA
151 bsl::uint64_t d_totalSize; // length of the entire message
152
153 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
154
155 unsigned char d_buffer[512 / 8]; // buffer for storing remaining part of
156 // message that is not yet incorporated
157 // into `d_state`
158
159 bsl::uint32_t d_state[8]; // state array storing the digest
160
161 // FRIENDS
162 friend bool operator==(const Sha224&, const Sha224&);
163
164 public:
165 // TYPES
166
167 /// The size (in bytes) of the output
168 static const bsl::size_t k_DIGEST_SIZE = 224 / 8;
169
170 // CREATORS
171
172 /// Construct a SHA-2 digest having the value corresponding to no data
173 /// having been provided.
175
176 /// Construct a SHA-2 digest corresponding to the specified `data`
177 /// having the specified `length` (in bytes). Note that if `data` is 0,
178 /// then `length` also must be 0.
179 Sha224(const void *data, bsl::size_t length);
180
181 // MANIPULATORS
182
183 /// Reset the value of this SHA-2 digest to the value provided by the
184 /// default constructor.
185 void reset();
186
187 /// Update the value of this SHA-2 digest to incorporate the specified
188 /// `data` having the specified `length` in bytes. If the current
189 /// state is the default state, the resultant value of this SHA-2
190 /// digest is the application of the SHA-2 algorithm upon the currently
191 /// given `data` of the given `length`. If this digest has been
192 /// previously provided data and has not been subsequently reset, the
193 /// current state is not the default state and the resultant value is
194 /// equivalent to applying the SHA-2 algorithm upon the concatenation of
195 /// all the provided data. The behavior is undefined unless the range
196 /// `[data, data + length)` is a valid range. Note that if `data` is 0,
197 /// then `length` must also be 0.
198 void update(const void *data, bsl::size_t length);
199
200 /// Load the current value of this SHA-2 digest into the specified
201 /// `result` and set the value of this SHA-2 digest to the value
202 /// provided by the default constructor.
203 void loadDigestAndReset(unsigned char *result);
204
205 // ACCESSORS
206
207 /// Load the value of this SHA-2 digest into the specified `result`.
208 void loadDigest(unsigned char *result) const;
209
210 /// Format the current value of this SHA-2 digest to the specified
211 /// output `stream` and return a reference to the modifiable `stream`.
212 bsl::ostream& print(bsl::ostream& stream) const;
213};
214
215 // ============
216 // class Sha256
217 // ============
218
219/// This `class` represents a SHA-256 digest that can be updated as
220/// additional data is provided.
221///
222/// More generally, this class supports a complete set of *value*
223/// *semantic* operations, including copy construction, assignment, equality
224/// comparison, and `ostream` printing. (A precise operational definition
225/// of when two instances have the same value can be found in the
226/// description of `operator==` for the class.) This container is
227/// *exception* *neutral* with no guarantee of rollback: if an exception is
228/// thrown during the invocation of a method on a pre-existing instance, the
229/// class is left in a valid state, but its value is undefined. In no event
230/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
231/// object as both source and destination) is supported in all cases.
232///
233/// See @ref bdlde_sha2
234class Sha256 {
235
236 // DATA
237 bsl::uint64_t d_totalSize; // length of the entire message
238
239 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
240
241 unsigned char d_buffer[512 / 8]; // buffer for storing remaining part of
242 // message that is not yet incorporated
243 // into `d_state`
244
245 bsl::uint32_t d_state[8]; // state array storing the digest
246
247 // FRIENDS
248 friend bool operator==(const Sha256&, const Sha256&);
249
250 public:
251 // TYPES
252
253 /// The size (in bytes) of the output
254 static const bsl::size_t k_DIGEST_SIZE = 256 / 8;
255
256 // CREATORS
257
258 /// Construct a SHA-2 digest having the value corresponding to no data
259 /// having been provided.
261
262 /// Construct a SHA-2 digest corresponding to the specified `data`
263 /// having the specified `length` (in bytes). Note that if `data` is 0,
264 /// then `length` also must be 0.
265 Sha256(const void *data, bsl::size_t length);
266
267 // MANIPULATORS
268
269 /// Reset the value of this SHA-2 digest to the value provided by the
270 /// default constructor.
271 void reset();
272
273 /// Update the value of this SHA-2 digest to incorporate the specified
274 /// `data` having the specified `length` in bytes. If the current
275 /// state is the default state, the resultant value of this SHA-2
276 /// digest is the application of the SHA-2 algorithm upon the currently
277 /// given `data` of the given `length`. If this digest has been
278 /// previously provided data and has not been subsequently reset, the
279 /// current state is not the default state and the resultant value is
280 /// equivalent to applying the SHA-2 algorithm upon the concatenation of
281 /// all the provided data. The behavior is undefined unless the range
282 /// `[data, data + length)` is a valid range. Note that if `data` is 0,
283 /// then `length` must also be 0.
284 void update(const void *data, bsl::size_t length);
285
286 /// Load the current value of this SHA-2 digest into the specified
287 /// `result` and set the value of this SHA-2 digest to the value
288 /// provided by the default constructor.
289 void loadDigestAndReset(unsigned char *result);
290
291 // ACCESSORS
292
293 /// Load the value of this SHA-2 digest into the specified `result`.
294 void loadDigest(unsigned char *result) const;
295
296 /// Format the current value of this SHA-2 digest to the specified
297 /// output `stream` and return a reference to the modifiable `stream`.
298 bsl::ostream& print(bsl::ostream& stream) const;
299};
300
301 // ============
302 // class Sha384
303 // ============
304
305/// This `class` represents a SHA-384 digest that can be updated as
306/// additional data is provided.
307///
308/// More generally, this class supports a complete set of *value*
309/// *semantic* operations, including copy construction, assignment, equality
310/// comparison, and `ostream` printing. (A precise operational definition
311/// of when two instances have the same value can be found in the
312/// description of `operator==` for the class.) This container is
313/// *exception* *neutral* with no guarantee of rollback: if an exception is
314/// thrown during the invocation of a method on a pre-existing instance, the
315/// class is left in a valid state, but its value is undefined. In no event
316/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
317/// object as both source and destination) is supported in all cases.
318///
319/// See @ref bdlde_sha2
320class Sha384 {
321
322 // DATA
323 bsl::uint64_t d_totalSize; // length of the entire message
324
325 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
326
327 unsigned char d_buffer[1024 / 8]; // buffer for storing remaining part of
328 // message that is not yet incorporated
329 // into `d_state`
330
331 bsl::uint64_t d_state[8]; // state array storing the digest
332
333 // FRIENDS
334 friend bool operator==(const Sha384&, const Sha384&);
335
336 public:
337 // TYPES
338
339 /// The size (in bytes) of the output
340 static const bsl::size_t k_DIGEST_SIZE = 384 / 8;
341
342 // CREATORS
343
344 /// Construct a SHA-2 digest having the value corresponding to no data
345 /// having been provided.
347
348 /// Construct a SHA-2 digest corresponding to the specified `data`
349 /// having the specified `length` (in bytes). Note that if `data` is 0,
350 /// then `length` also must be 0.
351 Sha384(const void *data, bsl::size_t length);
352
353 // MANIPULATORS
354
355 /// Reset the value of this SHA-2 digest to the value provided by the
356 /// default constructor.
357 void reset();
358
359 /// Update the value of this SHA-2 digest to incorporate the specified
360 /// `data` having the specified `length` in bytes. If the current
361 /// state is the default state, the resultant value of this SHA-2
362 /// digest is the application of the SHA-2 algorithm upon the currently
363 /// given `data` of the given `length`. If this digest has been
364 /// previously provided data and has not been subsequently reset, the
365 /// current state is not the default state and the resultant value is
366 /// equivalent to applying the SHA-2 algorithm upon the concatenation of
367 /// all the provided data. The behavior is undefined unless the range
368 /// `[data, data + length)` is a valid range. Note that if `data` is 0,
369 /// then `length` must also be 0.
370 void update(const void *data, bsl::size_t length);
371
372 /// Load the current value of this SHA-2 digest into the specified
373 /// `result` and set the value of this SHA-2 digest to the value
374 /// provided by the default constructor.
375 void loadDigestAndReset(unsigned char *result);
376
377 // ACCESSORS
378
379 /// Load the value of this SHA-2 digest into the specified `result`.
380 void loadDigest(unsigned char *result) const;
381
382 /// Format the current value of this SHA-2 digest to the specified
383 /// output `stream` and return a reference to the modifiable `stream`.
384 bsl::ostream& print(bsl::ostream& stream) const;
385};
386
387 // ============
388 // class Sha512
389 // ============
390
391/// This `class` represents a SHA-512 digest that can be updated as
392/// additional data is provided.
393///
394/// More generally, this class supports a complete set of *value*
395/// *semantic* operations, including copy construction, assignment, equality
396/// comparison, and `ostream` printing. (A precise operational definition
397/// of when two instances have the same value can be found in the
398/// description of `operator==` for the class.) This container is
399/// *exception* *neutral* with no guarantee of rollback: if an exception is
400/// thrown during the invocation of a method on a pre-existing instance, the
401/// class is left in a valid state, but its value is undefined. In no event
402/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
403/// object as both source and destination) is supported in all cases.
404///
405/// See @ref bdlde_sha2
406class Sha512 {
407
408 // DATA
409 bsl::uint64_t d_totalSize; // length of the entire message
410
411 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
412
413 unsigned char d_buffer[1024 / 8]; // buffer for storing remaining part of
414 // message that is not yet incorporated
415 // into `d_state`
416
417 bsl::uint64_t d_state[8]; // state array storing the digest
418
419 // FRIENDS
420 friend bool operator==(const Sha512&, const Sha512&);
421
422 public:
423 // TYPES
424
425 /// The size (in bytes) of the output
426 static const bsl::size_t k_DIGEST_SIZE = 512 / 8;
427
428 // CREATORS
429
430 /// Construct a SHA-2 digest having the value corresponding to no data
431 /// having been provided.
433
434 /// Construct a SHA-2 digest corresponding to the specified `data`
435 /// having the specified `length` (in bytes). Note that if `data` is 0,
436 /// then `length` also must be 0.
437 Sha512(const void *data, bsl::size_t length);
438
439 // MANIPULATORS
440
441 /// Reset the value of this SHA-2 digest to the value provided by the
442 /// default constructor.
443 void reset();
444
445 /// Update the value of this SHA-2 digest to incorporate the specified
446 /// `data` having the specified `length` in bytes. If the current
447 /// state is the default state, the resultant value of this SHA-2
448 /// digest is the application of the SHA-2 algorithm upon the currently
449 /// given `data` of the given `length`. If this digest has been
450 /// previously provided data and has not been subsequently reset, the
451 /// current state is not the default state and the resultant value is
452 /// equivalent to applying the SHA-2 algorithm upon the concatenation of
453 /// all the provided data. The behavior is undefined unless the range
454 /// `[data, data + length)` is a valid range. Note that if `data` is 0,
455 /// then `length` must also be 0.
456 void update(const void *data, bsl::size_t length);
457
458 /// Load the current value of this SHA-2 digest into the specified
459 /// `result` and set the value of this SHA-2 digest to the value
460 /// provided by the default constructor.
461 void loadDigestAndReset(unsigned char *result);
462
463 // ACCESSORS
464
465 /// Load the value of this SHA-2 digest into the specified `result`.
466 void loadDigest(unsigned char *result) const;
467
468 /// Format the current value of this SHA-2 digest to the specified
469 /// output `stream` and return a reference to the modifiable `stream`.
470 bsl::ostream& print(bsl::ostream& stream) const;
471};
472
473// FREE OPERATORS
474
475/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
476/// value, and `false` otherwise. Two digests have the same value if, after
477/// applying any number of equivalent updates to both (possibly including no
478/// updates), the values obtained from their respective `loadDigest` methods
479/// are identical.
480bool operator==(const Sha224& lhs, const Sha224& rhs);
481
482/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
483/// the same value, and `false` otherwise. Two digests do not have the same
484/// value if there exists a set of updates (possibly including the empty
485/// set) that, if applied to both, lead to different values being obtained
486/// from their respective `loadDigest` methods.
487inline
488bool operator!=(const Sha224& lhs, const Sha224& rhs);
489
490/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
491/// value, and `false` otherwise. Two digests have the same value if, after
492/// applying any number of equivalent updates to both (possibly including no
493/// updates), the values obtained from their respective `loadDigest` methods
494/// are identical.
495bool operator==(const Sha256& lhs, const Sha256& rhs);
496
497/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
498/// the same value, and `false` otherwise. Two digests do not have the same
499/// value if there exists a set of updates (possibly including the empty
500/// set) that, if applied to both, lead to different values being obtained
501/// from their respective `loadDigest` methods.
502inline
503bool operator!=(const Sha256& lhs, const Sha256& rhs);
504
505/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
506/// value, and `false` otherwise. Two digests have the same value if, after
507/// applying any number of equivalent updates to both (possibly including no
508/// updates), the values obtained from their respective `loadDigest` methods
509/// are identical.
510bool operator==(const Sha384& lhs, const Sha384& rhs);
511
512/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
513/// the same value, and `false` otherwise. Two digests do not have the same
514/// value if there exists a set of updates (possibly including the empty
515/// set) that, if applied to both, lead to different values being obtained
516/// from their respective `loadDigest` methods.
517inline
518bool operator!=(const Sha384& lhs, const Sha384& rhs);
519
520/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
521/// value, and `false` otherwise. Two digests have the same value if, after
522/// applying any number of equivalent updates to both (possibly including no
523/// updates), the values obtained from their respective `loadDigest` methods
524/// are identical.
525bool operator==(const Sha512& lhs, const Sha512& rhs);
526
527/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
528/// the same value, and `false` otherwise. Two digests do not have the same
529/// value if there exists a set of updates (possibly including the empty
530/// set) that, if applied to both, lead to different values being obtained
531/// from their respective `loadDigest` methods.
532inline
533bool operator!=(const Sha512& lhs, const Sha512& rhs);
534
535/// Write to the specified output `stream` the specified SHA-2 `digest` and
536/// return a reference to the modifiable `stream`.
537inline
538bsl::ostream& operator<<(bsl::ostream& stream, const Sha224& digest);
539
540/// Write to the specified output `stream` the specified SHA-2 `digest` and
541/// return a reference to the modifiable `stream`.
542inline
543bsl::ostream& operator<<(bsl::ostream& stream, const Sha256& digest);
544
545/// Write to the specified output `stream` the specified SHA-2 `digest` and
546/// return a reference to the modifiable `stream`.
547inline
548bsl::ostream& operator<<(bsl::ostream& stream, const Sha384& digest);
549
550/// Write to the specified output `stream` the specified SHA-2 `digest` and
551/// return a reference to the modifiable `stream`.
552inline
553bsl::ostream& operator<<(bsl::ostream& stream, const Sha512& digest);
554
555// ============================================================================
556// INLINE FUNCTION DEFINITIONS
557// ============================================================================
558
559} // close package namespace
560
561 // ------------
562 // class Sha224
563 // ------------
564
565// FREE OPERATORS
566inline
567bool bdlde::operator!=(const Sha224& lhs, const Sha224& rhs)
568{
569 return !(lhs == rhs);
570}
571
572inline
573bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha224& digest)
574{
575 return digest.print(stream);
576}
577
578 // ------------
579 // class Sha256
580 // ------------
581
582// FREE OPERATORS
583inline
584bool bdlde::operator!=(const Sha256& lhs, const Sha256& rhs)
585{
586 return !(lhs == rhs);
587}
588
589inline
590bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha256& digest)
591{
592 return digest.print(stream);
593}
594
595 // ------------
596 // class Sha384
597 // ------------
598
599inline
600bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha384& digest)
601{
602 return digest.print(stream);
603}
604
605// FREE OPERATORS
606inline
607bool bdlde::operator!=(const Sha384& lhs, const Sha384& rhs)
608{
609 return !(lhs == rhs);
610}
611
612 // ------------
613 // class Sha512
614 // ------------
615
616// FREE OPERATORS
617inline
618bool bdlde::operator!=(const Sha512& lhs, const Sha512& rhs)
619{
620 return !(lhs == rhs);
621}
622
623inline
624bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha512& digest)
625{
626 return digest.print(stream);
627}
628
629
630
631#endif
632
633// ----------------------------------------------------------------------------
634// Copyright 2018 Bloomberg Finance L.P.
635//
636// Licensed under the Apache License, Version 2.0 (the "License");
637// you may not use this file except in compliance with the License.
638// You may obtain a copy of the License at
639//
640// http://www.apache.org/licenses/LICENSE-2.0
641//
642// Unless required by applicable law or agreed to in writing, software
643// distributed under the License is distributed on an "AS IS" BASIS,
644// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
645// See the License for the specific language governing permissions and
646// limitations under the License.
647// ----------------------------- END-OF-FILE ----------------------------------
648
649/** @} */
650/** @} */
651/** @} */
Definition bdlde_sha2.h:148
void update(const void *data, bsl::size_t length)
void loadDigestAndReset(unsigned char *result)
static const bsl::size_t k_DIGEST_SIZE
The size (in bytes) of the output.
Definition bdlde_sha2.h:168
Sha224(const void *data, bsl::size_t length)
void loadDigest(unsigned char *result) const
Load the value of this SHA-2 digest into the specified result.
friend bool operator==(const Sha224 &, const Sha224 &)
bsl::ostream & print(bsl::ostream &stream) const
Definition bdlde_sha2.h:234
void loadDigestAndReset(unsigned char *result)
static const bsl::size_t k_DIGEST_SIZE
The size (in bytes) of the output.
Definition bdlde_sha2.h:254
Sha256(const void *data, bsl::size_t length)
bsl::ostream & print(bsl::ostream &stream) const
void update(const void *data, bsl::size_t length)
void loadDigest(unsigned char *result) const
Load the value of this SHA-2 digest into the specified result.
friend bool operator==(const Sha256 &, const Sha256 &)
Definition bdlde_sha2.h:320
friend bool operator==(const Sha384 &, const Sha384 &)
Sha384(const void *data, bsl::size_t length)
void update(const void *data, bsl::size_t length)
bsl::ostream & print(bsl::ostream &stream) const
static const bsl::size_t k_DIGEST_SIZE
The size (in bytes) of the output.
Definition bdlde_sha2.h:340
void loadDigest(unsigned char *result) const
Load the value of this SHA-2 digest into the specified result.
void loadDigestAndReset(unsigned char *result)
Definition bdlde_sha2.h:406
static const bsl::size_t k_DIGEST_SIZE
The size (in bytes) of the output.
Definition bdlde_sha2.h:426
Sha512(const void *data, bsl::size_t length)
void update(const void *data, bsl::size_t length)
bsl::ostream & print(bsl::ostream &stream) const
friend bool operator==(const Sha512 &, const Sha512 &)
void loadDigestAndReset(unsigned char *result)
void loadDigest(unsigned char *result) const
Load the value of this SHA-2 digest into the specified result.
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlde_base64alphabet.h:118
bool operator!=(const Base64DecoderOptions &lhs, const Base64DecoderOptions &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, Base64Alphabet::Enum value)