KMD5
#include <kmd5.h>
Public Types | |
typedef unsigned char | Digest[16] |
Public Member Functions | |
KMD5 (const char *in, int len=-1) | |
KMD5 (const QByteArray &a) | |
QByteArray | base64Digest () |
QByteArray | hexDigest () |
void | hexDigest (QByteArray &) |
const Digest & | rawDigest () |
void | rawDigest (KMD5::Digest &bin) |
void | reset () |
void | update (const char *in, int len=-1) |
void | update (const QByteArray &in) |
void | update (const unsigned char *in, int len=-1) |
bool | update (QIODevice &file) |
bool | verify (const KMD5::Digest &digest) |
bool | verify (const QByteArray &) |
Protected Member Functions | |
void | finalize () |
void | transform (const unsigned char buffer[64]) |
Detailed Description
An adapted C++ implementation of RSA Data Securities MD5 algorithm.
DEPRECATED. please use QCryptographicHash instead
The default constructor is designed to provide much the same functionality as the most commonly used C-implementation, while the other three constructors are meant to further simplify the process of obtaining a digest by calculating the result in a single step.
KMD5 is state-based, that means you can add new contents with update() as long as you didn't request the digest value yet. After the digest value was requested, the object is "finalized" and you have to call reset() to be able to do another calculation with it. The reason for this behavior is that upon requesting the message digest KMD5 has to pad the received contents up to a 64 byte boundary to calculate its value. After this operation it is not possible to resume consuming data.
Usage:
A common usage of this class:
To cut down on the unnecessary overhead of creating multiple KMD5 objects, you can simply invoke reset() to reuse the same object in making another calculation:
- See also
- QCryptographicHash
Constructor & Destructor Documentation
◆ KMD5() [1/2]
|
explicit |
◆ KMD5() [2/2]
|
explicit |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as above except it accepts a QByteArray as its argument.
Member Function Documentation
◆ base64Digest()
QByteArray KMD5::base64Digest | ( | ) |
Returns the value of the calculated message digest in a base64-encoded representation.
- Deprecated:
- please use QCryptographicHash::result().toBase64() instead
◆ finalize()
◆ hexDigest() [1/2]
QByteArray KMD5::hexDigest | ( | ) |
Returns the value of the calculated message digest in a hexadecimal representation.
- Deprecated:
- please use QCryptographicHash::result().toHex() instead
◆ hexDigest() [2/2]
void KMD5::hexDigest | ( | QByteArray & | s | ) |
◆ rawDigest() [1/2]
const KMD5::Digest & KMD5::rawDigest | ( | ) |
- Returns
- the raw representation of the digest
- Deprecated:
- please use QCryptographicHash::result instead
◆ rawDigest() [2/2]
void KMD5::rawDigest | ( | KMD5::Digest & | bin | ) |
◆ reset()
void KMD5::reset | ( | ) |
Calling this function will reset the calculated message digest.
Use this method to perform another message digest calculation without recreating the KMD5 object.
- Deprecated:
- please use QCryptographicHash::reset() instead
◆ transform()
|
protected |
◆ update() [1/4]
void KMD5::update | ( | const char * | in, |
int | len = -1 |
||
) |
Updates the message to be digested.
Be sure to add all data before you read the digest. After reading the digest, you can not add more data!
- Parameters
-
in message to be added to digest len the length of the given message.
- Deprecated:
- please use QCryptographicHash::addData instead
◆ update() [2/4]
void KMD5::update | ( | const QByteArray & | in | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
in message to be added to the digest (QByteArray).
- Deprecated:
- please use QCryptographicHash::addData instead
◆ update() [3/4]
void KMD5::update | ( | const unsigned char * | in, |
int | len = -1 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.please use QCryptographicHash::addData instead.
◆ update() [4/4]
bool KMD5::update | ( | QIODevice & | file | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.reads the data from an I/O device, i.e.
from a file (QFile).
NOTE that the file must be open for reading.
- Parameters
-
file a pointer to FILE as returned by calls like f{d,re}open
- Returns
- false if an error occurred during reading.
- Deprecated:
- please use QCryptographicHash::addData instead
◆ verify() [1/2]
bool KMD5::verify | ( | const KMD5::Digest & | digest | ) |
◆ verify() [2/2]
bool KMD5::verify | ( | const QByteArray & | hexdigest | ) |
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 03:54:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.