BDE 4.39.x 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` having the specified `length` (in bytes).
177 ///
178 /// \note Note that if `data` is 0,
179 /// then `length` also must be 0.
180 Sha224(const void *data, bsl::size_t length);
181
182 // MANIPULATORS
183
184 /// Reset the value of this SHA-2 digest to the value provided by the
185 /// default constructor.
186 void reset();
187
188 /// Update the value of this SHA-2 digest to incorporate the specified
189 /// `data` having the specified `length` in bytes. If the current
190 /// state is the default state, the resultant value of this SHA-2
191 /// digest is the application of the SHA-2 algorithm upon the currently
192 /// given `data` of the given `length`. If this digest has been
193 /// previously provided data and has not been subsequently reset, the
194 /// current state is not the default state and the resultant value is
195 /// equivalent to applying the SHA-2 algorithm upon the concatenation of all the provided data.
196 ///
197 /// \pre The behavior is undefined unless the range `[data, data + length)` is a valid range.
198 ///
199 /// \note Note that if `data` is 0,
200 /// then `length` must also be 0.
201 void update(const void *data, bsl::size_t length);
202
203 /// Load the current value of this SHA-2 digest into the specified
204 /// `result` and set the value of this SHA-2 digest to the value
205 /// provided by the default constructor.
206 void loadDigestAndReset(unsigned char *result);
207
208 // ACCESSORS
209
210 /// Load the value of this SHA-2 digest into the specified `result`.
211 void loadDigest(unsigned char *result) const;
212
213 /// Format the current value of this SHA-2 digest to the specified
214 /// output `stream` and return a reference to the modifiable `stream`.
215 bsl::ostream& print(bsl::ostream& stream) const;
216};
217
218 // ============
219 // class Sha256
220 // ============
221
222/// This `class` represents a SHA-256 digest that can be updated as
223/// additional data is provided.
224///
225/// More generally, this class supports a complete set of *value*
226/// *semantic* operations, including copy construction, assignment, equality
227/// comparison, and `ostream` printing. (A precise operational definition
228/// of when two instances have the same value can be found in the
229/// description of `operator==` for the class.) This container is
230/// *exception* *neutral* with no guarantee of rollback: if an exception is
231/// thrown during the invocation of a method on a pre-existing instance, the
232/// class is left in a valid state, but its value is undefined. In no event
233/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
234/// object as both source and destination) is supported in all cases.
235///
236/// See @ref bdlde_sha2
237class Sha256 {
238
239 // DATA
240 bsl::uint64_t d_totalSize; // length of the entire message
241
242 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
243
244 unsigned char d_buffer[512 / 8]; // buffer for storing remaining part of
245 // message that is not yet incorporated
246 // into `d_state`
247
248 bsl::uint32_t d_state[8]; // state array storing the digest
249
250 // FRIENDS
251 friend bool operator==(const Sha256&, const Sha256&);
252
253 public:
254 // TYPES
255
256 /// The size (in bytes) of the output
257 static const bsl::size_t k_DIGEST_SIZE = 256 / 8;
258
259 // CREATORS
260
261 /// Construct a SHA-2 digest having the value corresponding to no data
262 /// having been provided.
264
265 /// Construct a SHA-2 digest corresponding to the specified `data` having the specified `length` (in bytes).
266 ///
267 /// \note Note that if `data` is 0,
268 /// then `length` also must be 0.
269 Sha256(const void *data, bsl::size_t length);
270
271 // MANIPULATORS
272
273 /// Reset the value of this SHA-2 digest to the value provided by the
274 /// default constructor.
275 void reset();
276
277 /// Update the value of this SHA-2 digest to incorporate the specified
278 /// `data` having the specified `length` in bytes. If the current
279 /// state is the default state, the resultant value of this SHA-2
280 /// digest is the application of the SHA-2 algorithm upon the currently
281 /// given `data` of the given `length`. If this digest has been
282 /// previously provided data and has not been subsequently reset, the
283 /// current state is not the default state and the resultant value is
284 /// equivalent to applying the SHA-2 algorithm upon the concatenation of all the provided data.
285 ///
286 /// \pre The behavior is undefined unless the range `[data, data + length)` is a valid range.
287 ///
288 /// \note Note that if `data` is 0,
289 /// then `length` must also be 0.
290 void update(const void *data, bsl::size_t length);
291
292 /// Load the current value of this SHA-2 digest into the specified
293 /// `result` and set the value of this SHA-2 digest to the value
294 /// provided by the default constructor.
295 void loadDigestAndReset(unsigned char *result);
296
297 // ACCESSORS
298
299 /// Load the value of this SHA-2 digest into the specified `result`.
300 void loadDigest(unsigned char *result) const;
301
302 /// Format the current value of this SHA-2 digest to the specified
303 /// output `stream` and return a reference to the modifiable `stream`.
304 bsl::ostream& print(bsl::ostream& stream) const;
305};
306
307 // ============
308 // class Sha384
309 // ============
310
311/// This `class` represents a SHA-384 digest that can be updated as
312/// additional data is provided.
313///
314/// More generally, this class supports a complete set of *value*
315/// *semantic* operations, including copy construction, assignment, equality
316/// comparison, and `ostream` printing. (A precise operational definition
317/// of when two instances have the same value can be found in the
318/// description of `operator==` for the class.) This container is
319/// *exception* *neutral* with no guarantee of rollback: if an exception is
320/// thrown during the invocation of a method on a pre-existing instance, the
321/// class is left in a valid state, but its value is undefined. In no event
322/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
323/// object as both source and destination) is supported in all cases.
324///
325/// See @ref bdlde_sha2
326class Sha384 {
327
328 // DATA
329 bsl::uint64_t d_totalSize; // length of the entire message
330
331 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
332
333 unsigned char d_buffer[1024 / 8]; // buffer for storing remaining part of
334 // message that is not yet incorporated
335 // into `d_state`
336
337 bsl::uint64_t d_state[8]; // state array storing the digest
338
339 // FRIENDS
340 friend bool operator==(const Sha384&, const Sha384&);
341
342 public:
343 // TYPES
344
345 /// The size (in bytes) of the output
346 static const bsl::size_t k_DIGEST_SIZE = 384 / 8;
347
348 // CREATORS
349
350 /// Construct a SHA-2 digest having the value corresponding to no data
351 /// having been provided.
353
354 /// Construct a SHA-2 digest corresponding to the specified `data` having the specified `length` (in bytes).
355 ///
356 /// \note Note that if `data` is 0,
357 /// then `length` also must be 0.
358 Sha384(const void *data, bsl::size_t length);
359
360 // MANIPULATORS
361
362 /// Reset the value of this SHA-2 digest to the value provided by the
363 /// default constructor.
364 void reset();
365
366 /// Update the value of this SHA-2 digest to incorporate the specified
367 /// `data` having the specified `length` in bytes. If the current
368 /// state is the default state, the resultant value of this SHA-2
369 /// digest is the application of the SHA-2 algorithm upon the currently
370 /// given `data` of the given `length`. If this digest has been
371 /// previously provided data and has not been subsequently reset, the
372 /// current state is not the default state and the resultant value is
373 /// equivalent to applying the SHA-2 algorithm upon the concatenation of all the provided data.
374 ///
375 /// \pre The behavior is undefined unless the range `[data, data + length)` is a valid range.
376 ///
377 /// \note Note that if `data` is 0,
378 /// then `length` must also be 0.
379 void update(const void *data, bsl::size_t length);
380
381 /// Load the current value of this SHA-2 digest into the specified
382 /// `result` and set the value of this SHA-2 digest to the value
383 /// provided by the default constructor.
384 void loadDigestAndReset(unsigned char *result);
385
386 // ACCESSORS
387
388 /// Load the value of this SHA-2 digest into the specified `result`.
389 void loadDigest(unsigned char *result) const;
390
391 /// Format the current value of this SHA-2 digest to the specified
392 /// output `stream` and return a reference to the modifiable `stream`.
393 bsl::ostream& print(bsl::ostream& stream) const;
394};
395
396 // ============
397 // class Sha512
398 // ============
399
400/// This `class` represents a SHA-512 digest that can be updated as
401/// additional data is provided.
402///
403/// More generally, this class supports a complete set of *value*
404/// *semantic* operations, including copy construction, assignment, equality
405/// comparison, and `ostream` printing. (A precise operational definition
406/// of when two instances have the same value can be found in the
407/// description of `operator==` for the class.) This container is
408/// *exception* *neutral* with no guarantee of rollback: if an exception is
409/// thrown during the invocation of a method on a pre-existing instance, the
410/// class is left in a valid state, but its value is undefined. In no event
411/// is memory leaked. Finally, *aliasing* (e.g., using all or part of an
412/// object as both source and destination) is supported in all cases.
413///
414/// See @ref bdlde_sha2
415class Sha512 {
416
417 // DATA
418 bsl::uint64_t d_totalSize; // length of the entire message
419
420 bsl::uint64_t d_bufferSize; // bytes currently used for `d_buffer`
421
422 unsigned char d_buffer[1024 / 8]; // buffer for storing remaining part of
423 // message that is not yet incorporated
424 // into `d_state`
425
426 bsl::uint64_t d_state[8]; // state array storing the digest
427
428 // FRIENDS
429 friend bool operator==(const Sha512&, const Sha512&);
430
431 public:
432 // TYPES
433
434 /// The size (in bytes) of the output
435 static const bsl::size_t k_DIGEST_SIZE = 512 / 8;
436
437 // CREATORS
438
439 /// Construct a SHA-2 digest having the value corresponding to no data
440 /// having been provided.
442
443 /// Construct a SHA-2 digest corresponding to the specified `data` having the specified `length` (in bytes).
444 ///
445 /// \note Note that if `data` is 0,
446 /// then `length` also must be 0.
447 Sha512(const void *data, bsl::size_t length);
448
449 // MANIPULATORS
450
451 /// Reset the value of this SHA-2 digest to the value provided by the
452 /// default constructor.
453 void reset();
454
455 /// Update the value of this SHA-2 digest to incorporate the specified
456 /// `data` having the specified `length` in bytes. If the current
457 /// state is the default state, the resultant value of this SHA-2
458 /// digest is the application of the SHA-2 algorithm upon the currently
459 /// given `data` of the given `length`. If this digest has been
460 /// previously provided data and has not been subsequently reset, the
461 /// current state is not the default state and the resultant value is
462 /// equivalent to applying the SHA-2 algorithm upon the concatenation of all the provided data.
463 ///
464 /// \pre The behavior is undefined unless the range `[data, data + length)` is a valid range.
465 ///
466 /// \note Note that if `data` is 0,
467 /// then `length` must also be 0.
468 void update(const void *data, bsl::size_t length);
469
470 /// Load the current value of this SHA-2 digest into the specified
471 /// `result` and set the value of this SHA-2 digest to the value
472 /// provided by the default constructor.
473 void loadDigestAndReset(unsigned char *result);
474
475 // ACCESSORS
476
477 /// Load the value of this SHA-2 digest into the specified `result`.
478 void loadDigest(unsigned char *result) const;
479
480 /// Format the current value of this SHA-2 digest to the specified
481 /// output `stream` and return a reference to the modifiable `stream`.
482 bsl::ostream& print(bsl::ostream& stream) const;
483};
484
485// FREE OPERATORS
486
487/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
488/// value, and `false` otherwise. Two digests have the same value if, after
489/// applying any number of equivalent updates to both (possibly including no
490/// updates), the values obtained from their respective `loadDigest` methods
491/// are identical.
492bool operator==(const Sha224& lhs, const Sha224& rhs);
493
494/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
495/// the same value, and `false` otherwise. Two digests do not have the same
496/// value if there exists a set of updates (possibly including the empty
497/// set) that, if applied to both, lead to different values being obtained
498/// from their respective `loadDigest` methods.
499inline
500bool operator!=(const Sha224& lhs, const Sha224& rhs);
501
502/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
503/// value, and `false` otherwise. Two digests have the same value if, after
504/// applying any number of equivalent updates to both (possibly including no
505/// updates), the values obtained from their respective `loadDigest` methods
506/// are identical.
507bool operator==(const Sha256& lhs, const Sha256& rhs);
508
509/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
510/// the same value, and `false` otherwise. Two digests do not have the same
511/// value if there exists a set of updates (possibly including the empty
512/// set) that, if applied to both, lead to different values being obtained
513/// from their respective `loadDigest` methods.
514inline
515bool operator!=(const Sha256& lhs, const Sha256& rhs);
516
517/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
518/// value, and `false` otherwise. Two digests have the same value if, after
519/// applying any number of equivalent updates to both (possibly including no
520/// updates), the values obtained from their respective `loadDigest` methods
521/// are identical.
522bool operator==(const Sha384& lhs, const Sha384& rhs);
523
524/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
525/// the same value, and `false` otherwise. Two digests do not have the same
526/// value if there exists a set of updates (possibly including the empty
527/// set) that, if applied to both, lead to different values being obtained
528/// from their respective `loadDigest` methods.
529inline
530bool operator!=(const Sha384& lhs, const Sha384& rhs);
531
532/// Return `true` if the specified `lhs` and `rhs` SHA digests have the same
533/// value, and `false` otherwise. Two digests have the same value if, after
534/// applying any number of equivalent updates to both (possibly including no
535/// updates), the values obtained from their respective `loadDigest` methods
536/// are identical.
537bool operator==(const Sha512& lhs, const Sha512& rhs);
538
539/// Return `true` if the specified `lhs` and `rhs` SHA digests do not have
540/// the same value, and `false` otherwise. Two digests do not have the same
541/// value if there exists a set of updates (possibly including the empty
542/// set) that, if applied to both, lead to different values being obtained
543/// from their respective `loadDigest` methods.
544inline
545bool operator!=(const Sha512& lhs, const Sha512& rhs);
546
547/// Write to the specified output `stream` the specified SHA-2 `digest` and
548/// return a reference to the modifiable `stream`.
549inline
550bsl::ostream& operator<<(bsl::ostream& stream, const Sha224& digest);
551
552/// Write to the specified output `stream` the specified SHA-2 `digest` and
553/// return a reference to the modifiable `stream`.
554inline
555bsl::ostream& operator<<(bsl::ostream& stream, const Sha256& digest);
556
557/// Write to the specified output `stream` the specified SHA-2 `digest` and
558/// return a reference to the modifiable `stream`.
559inline
560bsl::ostream& operator<<(bsl::ostream& stream, const Sha384& digest);
561
562/// Write to the specified output `stream` the specified SHA-2 `digest` and
563/// return a reference to the modifiable `stream`.
564inline
565bsl::ostream& operator<<(bsl::ostream& stream, const Sha512& digest);
566
567// ============================================================================
568// INLINE FUNCTION DEFINITIONS
569// ============================================================================
570
571} // close package namespace
572
573 // ------------
574 // class Sha224
575 // ------------
576
577// FREE OPERATORS
578inline
579bool bdlde::operator!=(const Sha224& lhs, const Sha224& rhs)
580{
581 return !(lhs == rhs);
582}
583
584inline
585bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha224& digest)
586{
587 return digest.print(stream);
588}
589
590 // ------------
591 // class Sha256
592 // ------------
593
594// FREE OPERATORS
595inline
596bool bdlde::operator!=(const Sha256& lhs, const Sha256& rhs)
597{
598 return !(lhs == rhs);
599}
600
601inline
602bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha256& digest)
603{
604 return digest.print(stream);
605}
606
607 // ------------
608 // class Sha384
609 // ------------
610
611inline
612bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha384& digest)
613{
614 return digest.print(stream);
615}
616
617// FREE OPERATORS
618inline
619bool bdlde::operator!=(const Sha384& lhs, const Sha384& rhs)
620{
621 return !(lhs == rhs);
622}
623
624 // ------------
625 // class Sha512
626 // ------------
627
628// FREE OPERATORS
629inline
630bool bdlde::operator!=(const Sha512& lhs, const Sha512& rhs)
631{
632 return !(lhs == rhs);
633}
634
635inline
636bsl::ostream& bdlde::operator<<(bsl::ostream& stream, const Sha512& digest)
637{
638 return digest.print(stream);
639}
640
641
642
643#endif
644
645// ----------------------------------------------------------------------------
646// Copyright 2018 Bloomberg Finance L.P.
647//
648// Licensed under the Apache License, Version 2.0 (the "License");
649// you may not use this file except in compliance with the License.
650// You may obtain a copy of the License at
651//
652// http://www.apache.org/licenses/LICENSE-2.0
653//
654// Unless required by applicable law or agreed to in writing, software
655// distributed under the License is distributed on an "AS IS" BASIS,
656// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
657// See the License for the specific language governing permissions and
658// limitations under the License.
659// ----------------------------- END-OF-FILE ----------------------------------
660
661/** @} */
662/** @} */
663/** @} */
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:237
void loadDigestAndReset(unsigned char *result)
static const bsl::size_t k_DIGEST_SIZE
The size (in bytes) of the output.
Definition bdlde_sha2.h:257
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:326
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:346
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:415
static const bsl::size_t k_DIGEST_SIZE
The size (in bytes) of the output.
Definition bdlde_sha2.h:435
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)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlde_base64alphabet.h:118
bool operator!=(const Base64DecoderOptions &lhs, const Base64DecoderOptions &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, Base64Alphabet::Enum value)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917