Virgil Security Crypto library
1.8.2
|
Provides hashing (message digest) algorithms. More...
#include <VirgilHash.h>
Public Member Functions | |
Constructor / Destructor | |
VirgilHash () | |
Create object with undefined algorithm. More... | |
virtual | ~VirgilHash () throw () |
Polymorphic destructor. | |
Info | |
Provide detail information about object. | |
std::string | name () const |
Returns name of the hash function. More... | |
int | type () const |
Return underlying hash type. More... | |
Immediate Hashing | |
This methods can be used to get the message hash immediately. | |
virgil::crypto::VirgilByteArray | hash (const virgil::crypto::VirgilByteArray &bytes) const |
Produce hash. More... | |
Chain Hashing | |
This methods provide mechanism to hash long message, that can be splitted to a shorter chunks and be processed separately. | |
void | start () |
Initialize hashing for the new message hash. | |
void | update (const virgil::crypto::VirgilByteArray &bytes) |
Update / process message hash. More... | |
virgil::crypto::VirgilByteArray | finish () |
Return final message hash. More... | |
HMAC Immediate Hashing | |
This methods can be used to get the message HMAC hash immediately. | |
virgil::crypto::VirgilByteArray | hmac (const virgil::crypto::VirgilByteArray &key, const virgil::crypto::VirgilByteArray &bytes) const |
Produce HMAC hash. More... | |
HMAC Chain Hashing | |
This methods provide mechanism to get HMAC hash of the long message, that can be splitted to a shorter chunks and be processed separately. | |
void | hmacStart (const virgil::crypto::VirgilByteArray &key) |
Initialize HMAC hashing for the new message hash. More... | |
void | hmacReset () |
Reset HMAC hashing for the new message hash. | |
void | hmacUpdate (const virgil::crypto::VirgilByteArray &bytes) |
Update / process message HMAC hash. More... | |
virgil::crypto::VirgilByteArray | hmacFinish () |
Return final message HMAC hash. More... | |
Copy constructor / assignment operator | |
| |
VirgilHash (const VirgilHash &other) | |
VirgilHash & | operator= (const VirgilHash &rhs) |
VirgilAsn1Compatible implementation | |
virtual size_t | asn1Write (virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const |
Write object state to the writer. More... | |
virtual void | asn1Read (virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader) |
Read object state from the reader. More... | |
Public Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible | |
virgil::crypto::VirgilByteArray | toAsn1 () const |
Save object state to the ASN.1 structure. | |
void | fromAsn1 (const virgil::crypto::VirgilByteArray &asn1) |
Restore object state from the ASN.1 structure. | |
virtual | ~VirgilAsn1Compatible () throw () |
Polymorphic destructor. | |
Static Public Member Functions | |
Creation methods | |
Object creation with specific hash function. | |
static VirgilHash | md5 () |
static VirgilHash | sha256 () |
static VirgilHash | sha384 () |
static VirgilHash | sha512 () |
static VirgilHash | withName (const virgil::crypto::VirgilByteArray &name) |
Additional Inherited Members | |
Protected Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible | |
virtual void | checkAsn1ParamNotEmpty (const virgil::crypto::VirgilByteArray ¶m, const char *paramName=0) const |
If given parameter is empty exception will be thrown. More... | |
Provides hashing (message digest) algorithms.
virgil::crypto::foundation::VirgilHash::VirgilHash | ( | ) |
Create object with undefined algorithm.
|
virtual |
Read object state from the reader.
asn1Reader | reader payloaded with ASN.1 to be read. |
Implements virgil::crypto::foundation::asn1::VirgilAsn1Compatible.
|
virtual |
Write object state to the writer.
asn1Writer | writer that should be payloaded by subclasses. |
childWrittenBytes | count of bytes that was written by subclasses. |
Implements virgil::crypto::foundation::asn1::VirgilAsn1Compatible.
virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilHash::finish | ( | ) |
virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilHash::hash | ( | const virgil::crypto::VirgilByteArray & | bytes | ) | const |
Produce hash.
Process the given message immediately and return it's hash.
bytes | - message to be hashed. |
virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilHash::hmac | ( | const virgil::crypto::VirgilByteArray & | key, |
const virgil::crypto::VirgilByteArray & | bytes | ||
) | const |
Produce HMAC hash.
Process the given message immediately and return it's HMAC hash.
key | - secret key. |
bytes | - message to be hashed. |
virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilHash::hmacFinish | ( | ) |
Return final message HMAC hash.
void virgil::crypto::foundation::VirgilHash::hmacStart | ( | const virgil::crypto::VirgilByteArray & | key | ) |
Initialize HMAC hashing for the new message hash.
key | - secret key. |
void virgil::crypto::foundation::VirgilHash::hmacUpdate | ( | const virgil::crypto::VirgilByteArray & | bytes | ) |
Update / process message HMAC hash.
This method MUST be used after hmacStart() or hmacReset() methods only. This method MAY be called multiple times to process long message splitted to a shorter chunks.
bytes | - message to be hashed. |
std::string virgil::crypto::foundation::VirgilHash::name | ( | ) | const |
Returns name of the hash function.
int virgil::crypto::foundation::VirgilHash::type | ( | ) | const |
Return underlying hash type.
void virgil::crypto::foundation::VirgilHash::update | ( | const virgil::crypto::VirgilByteArray & | bytes | ) |