10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::crypto::MessageDigest Class Referenceabstract

#include <MessageDigest.h>

Detailed Description

Simple MessageDigest -service.

Instances are not thread-safe.

Construction may throw tenduke::crypto::CryptoException.

Inheritance diagram for tenduke::crypto::MessageDigest:
tenduke::crypto::libcrypto::LibCryptoMessageDigest tenduke::test::mocks::MessageDigestMock

Public Types

enum  Algorithm { NONE , SHA256 }
 Supported algorithms.
 

Public Member Functions

virtual std::size_t length () const =0
 Returns length (in bytes) of the resulting digest.
 
virtual MessageDigestupdate (const unsigned char *message, std::size_t messageLength)=0
 Updates the digest.
 
virtual void digestTo (unsigned char *messageDigest)=0
 Computes the digest to pre-allocated buffer.
 
virtual std::unique_ptr< tenduke::utl::BinaryDatadigest ()=0
 Computes the digest.
 

Static Public Member Functions

static std::string algorithmToString (enum MessageDigest::Algorithm algorithm)
 Converts algorithm to string representation.
 
static enum MessageDigest::Algorithm stringToAlgorithm (const std::string &string)
 Converts string to algorithm.
 
static enum MessageDigest::Algorithm stringToAlgorithm (const char *string)
 Converts string to algorithm.
 

Member Function Documentation

◆ algorithmToString()

std::string tenduke::crypto::MessageDigest::algorithmToString ( enum MessageDigest::Algorithm  algorithm)
static

Converts algorithm to string representation.

Parameters
algorithm-
Returns
-

◆ digest()

virtual std::unique_ptr< tenduke::utl::BinaryData > tenduke::crypto::MessageDigest::digest ( )
pure virtual

Computes the digest.

Returns
data-object containing the digest
Exceptions
tenduke::crypto::CryptoExceptionon error

Implemented in tenduke::crypto::libcrypto::LibCryptoMessageDigest.

◆ digestTo()

virtual void tenduke::crypto::MessageDigest::digestTo ( unsigned char *  messageDigest)
pure virtual

Computes the digest to pre-allocated buffer.

Parameters
messageDigestthe computed digest is placed here (needs to proper size, use MessageDigest::length()).
Exceptions
tenduke::crypto::CryptoExceptionon error

Implemented in tenduke::crypto::libcrypto::LibCryptoMessageDigest.

◆ length()

virtual std::size_t tenduke::crypto::MessageDigest::length ( ) const
pure virtual

Returns length (in bytes) of the resulting digest.

Returns
-

Implemented in tenduke::crypto::libcrypto::LibCryptoMessageDigest.

◆ stringToAlgorithm() [1/2]

xdcrypto::MessageDigest::Algorithm tenduke::crypto::MessageDigest::stringToAlgorithm ( const char *  string)
static

Converts string to algorithm.

Parameters
string-
Returns
-

◆ stringToAlgorithm() [2/2]

xdcrypto::MessageDigest::Algorithm tenduke::crypto::MessageDigest::stringToAlgorithm ( const std::string &  string)
static

Converts string to algorithm.

Parameters
string-
Returns
-

◆ update()

virtual MessageDigest * tenduke::crypto::MessageDigest::update ( const unsigned char *  message,
std::size_t  messageLength 
)
pure virtual

Updates the digest.

Parameters
message-
messageLength-
Returns
this instance for chaining
Exceptions
tenduke::crypto::CryptoExceptionon error

Implemented in tenduke::crypto::libcrypto::LibCryptoMessageDigest.


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