Loading [MathJax]/extensions/tex2jax.js
Adobe Source Libraries 1.49.0
A collection of C++ libraries.
SHA (Secure Hash Algorithm)

Classes

class  sha< Traits >

Typedefs

typedef traits_type::digest_type digest_type
typedef sha< implementation::sha1_traits_t > sha1_t
 A bit-oriented implementation of the SHA-1 Secure Hash Algorithm.
typedef sha< implementation::sha224_traits_t > sha224_t
 A bit-oriented implementation of the SHA-224 Secure Hash Algorithm.
typedef sha< implementation::sha256_traits_t > sha256_t
 A bit-oriented implementation of the SHA-256 Secure Hash Algorithm.
typedef sha< implementation::sha384_traits_t > sha384_t
 A bit-oriented implementation of the SHA-384 Secure Hash Algorithm.
typedef sha< implementation::sha512_traits_t > sha512_t
 A bit-oriented implementation of the SHA-512 Secure Hash Algorithm.

Functions

 sha ()
template<typename I>
void update (I first, I last)
template<typename I>
void update (I first, std::uint64_t num_bits)
digest_type finalize ()
template<typename I>
static digest_type digest (I first, I last)
template<typename I>
static digest_type digest (I first, std::uint64_t num_bits)

Detailed Description

Typedef Documentation

◆ digest_type

template<class Traits>
typedef traits_type::digest_type digest_type

A statically-sized, contiguous array for the resulting SHA-* digest.

Note
the size of this digest will change depending on the SHA routine in use.

Definition at line 778 of file sha.hpp.

◆ sha1_t

typedef sha<implementation::sha1_traits_t> sha1_t

Definition at line 966 of file sha.hpp.

◆ sha224_t

typedef sha<implementation::sha224_traits_t> sha224_t

Definition at line 974 of file sha.hpp.

◆ sha256_t

typedef sha<implementation::sha256_traits_t> sha256_t

Definition at line 982 of file sha.hpp.

◆ sha384_t

typedef sha<implementation::sha384_traits_t> sha384_t

Definition at line 990 of file sha.hpp.

◆ sha512_t

typedef sha<implementation::sha512_traits_t> sha512_t

Definition at line 998 of file sha.hpp.

Function Documentation

◆ sha()

template<class Traits>
sha ( )

Sets the state of the digest machine to its default.

Definition at line 785 of file sha.hpp.

◆ update() [1/2]

template<class Traits>
template<typename I>
void update ( I first,
I last )

This routine can be called successively to digest a data over one or more steps.

Precondition
sizeof(std::iterator_traits<I>::value_type) must be 1
Parameters
firstfirst iterator over the range to digest
lastlast iterator over the range to digest
Note
While the SHA standard specifies the ability to process messages up to 2^128 bits, this routine is limited to sizeof(std::iterator_traits<I>::difference_type) * 8 bits. A workaround to the limitation is to call this routine multiple times. Even then, the total message length is limited to 2^64 bits.

Definition at line 808 of file sha.hpp.

◆ update() [2/2]

template<class Traits>
template<typename I>
void update ( I first,
std::uint64_t num_bits )

This routine can be called successively to digest a data over one or more steps.

Precondition
sizeof(std::iterator_traits<I>::value_type) must be 1
Parameters
firstfirst iterator over the range to digest
num_bitsnumber of bits to digest
Note
While the SHA standard specifies the ability to process messages up to 2^128 bits, this routine is limited to messages of 2^64 bits in length.
If update is called multiple times all but the last call must have num_bits % 8 == 0

Definition at line 836 of file sha.hpp.

◆ finalize()

template<class Traits>
digest_type finalize ( )
Returns
The SHA-* digest of the message

Definition at line 850 of file sha.hpp.

◆ digest() [1/2]

template<class Traits>
template<typename I>
digest_type digest ( I first,
I last )
static
Precondition
sizeof(std::iterator_traits<I>::value_type) must be 1
Parameters
firstfirst iterator over the range to digest
lastlast iterator over the range to digest
Note
While the SHA standard specifies the ability to process messages up to 2^128 bits, this routine is limited to sizeof(std::iterator_traits<I>::difference_type) * 8 bits.
Returns
The SHA-* digest of the message

Definition at line 876 of file sha.hpp.

◆ digest() [2/2]

template<class Traits>
template<typename I>
digest_type digest ( I first,
std::uint64_t num_bits )
static
Precondition
sizeof(std::iterator_traits<I>::value_type) must be 1
Parameters
firstfirst iterator over the range to digest
num_bitsnumber of bits to digest
Note
While the SHA standard specifies the ability to process messages up to 2^128 bits, this routine is limited to messages of 2^64 bits in length.
Returns
The SHA-* digest of the message

Definition at line 899 of file sha.hpp.