TSDuck v3.46-4930
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::SHA512 Class Reference

#include <tsSHA512.h>

Inheritance diagram for ts::SHA512:
Collaboration diagram for ts::SHA512:

Public Member Functions

 SHA512 ()
 Constructor.
virtual ~SHA512 () override
 Destructor.
virtual bool add (const void *data, size_t size)
virtual bool getHash (void *hash, size_t bufsize, size_t *retsize=nullptr)
bool hash (const void *data, size_t data_size, ByteBlock &hash)
bool hash (const void *data, size_t data_size, void *hash, size_t hash_maxsize, size_t *hash_retsize=nullptr)
size_t hashSize () const
virtual bool init ()
UString name () const

Static Public Attributes

static constexpr size_t HASH_SIZE = 512/8

Protected Member Functions

virtual void getAlgorithm (::BCRYPT_ALG_HANDLE &algo, size_t &length) const override
virtual const EVP_MD_CTX * referenceContext () const

Detailed Description

SHA-512 hash.

Member Function Documentation

◆ getAlgorithm()

virtual void ts::SHA512::getAlgorithm ( ::BCRYPT_ALG_HANDLE & algo,
size_t & length ) const
overrideprotectedvirtual

Get the algorithm handle and subobject size, when the subclass uses Microsoft BCrypt library.

Parameters
[out]algoHandle to hash algorithm.
[out]lengthLength in bytes of the subobject to allocate.

Reimplemented from ts::Hash.

◆ name()

UString ts::Hash::name ( ) const
inlineinherited

Algorithm name (informational only).

Returns
The algorithm name.

◆ hashSize()

size_t ts::Hash::hashSize ( ) const
inlineinherited

Size in bytes of the resulting hash.

Returns
The size in bytes of the resulting hash.

◆ init()

virtual bool ts::Hash::init ( )
virtualinherited

Reinitialize the computation of the hash.

Returns
True on success, false on error.

◆ add()

virtual bool ts::Hash::add ( const void * data,
size_t size )
virtualinherited

Add some part of the message to hash. Can be called several times.

Parameters
[in]dataAddress of message part.
[in]sizeSize in bytes of message part.
Returns
True on success, false on error.

◆ getHash()

virtual bool ts::Hash::getHash ( void * hash,
size_t bufsize,
size_t * retsize = nullptr )
virtualinherited

Get the resulting hash value.

Parameters
[out]hashAddress of returned hash buffer.
[in]bufsizeSize in bytes of hash buffer.
[out]retsizeAddress of an integer receiving the actual returned hash size. Can be a null pointer (ignored).
Returns
True on success, false on error.

◆ hash() [1/2]

bool ts::Hash::hash ( const void * data,
size_t data_size,
void * hash,
size_t hash_maxsize,
size_t * hash_retsize = nullptr )
inherited

Compute a hash in one operation. Same in init() + add() + getHash().

Parameters
[in]dataAddress of message to hash.
[in]data_sizeSize in bytes of message to hash.
[out]hashAddress of returned hash buffer.
[in]hash_maxsizeSize in bytes of hash buffer.
[out]hash_retsizeAddress of an integer receiving the actual returned hash size. Can be a null pointer (ignored).
Returns
True on success, false on error.

◆ hash() [2/2]

bool ts::Hash::hash ( const void * data,
size_t data_size,
ByteBlock & hash )
inherited

Compute a hash in one operation. Same in init() + add() + getHash().

Parameters
[in]dataAddress of message to hash.
[in]data_sizeSize in bytes of message to hash.
[out]hashReturned hash buffer.
Returns
True on success, false on error.

◆ referenceContext()

virtual const EVP_MD_CTX * ts::Hash::referenceContext ( ) const
protectedvirtualinherited

Get reference hash context, when the subclass uses OpenSSL.

Returns
Reference EVP hash context. To be copied into each new hash object.

Member Data Documentation

◆ HASH_SIZE

size_t ts::SHA512::HASH_SIZE = 512/8
staticconstexpr

SHA-512 hash size in bytes (512 bits).


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