wxExtend
Additional templates and function helpers for wxWidgets
Public Member Functions | Protected Attributes | List of all members
wxCryptoHash Class Reference

Cryptographics Hash Base. More...

#include <wxex/crypto.h>

Inheritance diagram for wxCryptoHash:
wxCryptoHashSHA1

Public Member Functions

 wxCryptoHash ()
 Creates a new cryptographics hash.
 
virtual ~wxCryptoHash ()
 Destructor.
 
bool IsOk () const noexcept
 Has the hash creation been successful? More...
 
 operator HCRYPTHASH () const noexcept
 
bool Hash (_In_reads_bytes_(size) const void *data, size_t size)
 Hashes given block of data. More...
 
bool Hash (const wxMemoryBuffer &data)
 Hashes given block of data. More...
 
bool HashAsUTF8 (const wxString &str)
 Converts string to UTF-8 and hashes it. More...
 
bool HashFile (const wxString &fileName)
 Hashes a file. More...
 
virtual bool GetValue (wxMemoryBuffer &hash)
 Finish hashing and return hash data. More...
 
bool Sign (wxMemoryBuffer &signature)
 Signs the hash using session key. More...
 
wxMemoryBuffer Sign ()
 Signs the hash using session key. More...
 

Protected Attributes

HCRYPTHASH m_h
 Hash Handle.
 

Detailed Description

Cryptographics Hash Base.

Member Function Documentation

◆ GetValue()

bool wxCryptoHash::GetValue ( wxMemoryBuffer &  hash)
virtual

Finish hashing and return hash data.

Parameters
[out]hashHash data
Returns
  • true if succeeded
  • false otherwise

Reimplemented in wxCryptoHashSHA1.

◆ Hash() [1/2]

bool wxCryptoHash::Hash ( _In_reads_bytes_(size) const void *  data,
size_t  size 
)

Hashes given block of data.

Parameters
[in]dataPointer to memory block
[in]sizeSize of memory block in bytes
Returns
  • true if hashing succeeded
  • false otherwise

◆ Hash() [2/2]

bool wxCryptoHash::Hash ( const wxMemoryBuffer &  data)
inline

Hashes given block of data.

Parameters
[in]dataMemory block
Returns
  • true if hashing succeeded
  • false otherwise

◆ HashAsUTF8()

bool wxCryptoHash::HashAsUTF8 ( const wxString &  str)
inline

Converts string to UTF-8 and hashes it.

Parameters
[in]strString to hash
Returns
  • true if hashing succeeded
  • false otherwise

◆ HashFile()

bool wxCryptoHash::HashFile ( const wxString &  fileName)
inline

Hashes a file.

Parameters
[in]fileNameThe path of the file to calculate hash of
Returns
  • true if hashing succeeded
  • false otherwise

◆ IsOk()

bool wxCryptoHash::IsOk ( ) const
inlinenoexcept

Has the hash creation been successful?

Returns
  • true if creation succeeded
  • false otherwise

◆ operator HCRYPTHASH()

wxCryptoHash::operator HCRYPTHASH ( ) const
inlinenoexcept
Returns
Hash handle to be used in native API calls.

◆ Sign() [1/2]

wxMemoryBuffer wxCryptoHash::Sign ( )
inline

Signs the hash using session key.

Returns
Digital Signature

◆ Sign() [2/2]

bool wxCryptoHash::Sign ( wxMemoryBuffer &  signature)

Signs the hash using session key.

Parameters
[in,out]signatureDigital signature
Returns
  • true if signing succeeded
  • false otherwise

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