KMD5 Class Reference
An adapted C++ implementation of RSA Data Securities MD5 algorithm. More...
#include <kmdcodec.h>
Public Types | |
typedef unsigned char | Digest [16] |
Public Member Functions | |
KMD5 (const char *in, int len=-1) | |
KMD5 (const QByteArray &a) | |
KMD5 (const QCString &a) | |
void | update (const char *in, int len=-1) |
void | update (const unsigned char *in, int len=-1) |
void | update (const QByteArray &in) |
void | update (const QCString &in) |
bool | update (QIODevice &file) |
void | reset () |
const Digest & | rawDigest () |
void | rawDigest (KMD5::Digest &bin) |
QCString | hexDigest () |
void | hexDigest (QCString &) |
QCString | base64Digest () |
bool | verify (const KMD5::Digest &digest) |
bool | verify (const QCString &) |
Protected Member Functions | |
void | transform (const unsigned char buffer[64]) |
void | finalize () |
Detailed Description
An adapted C++ implementation of RSA Data Securities MD5 algorithm.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:
- Author:
- Dirk Mueller <mueller@kde.org>, Dawit Alemayehu <adawit@kde.org>
Definition at line 402 of file kmdcodec.h.
Constructor & Destructor Documentation
|
Constructor that updates the digest for the given string.
Definition at line 757 of file kmdcodec.cpp. References update(). |
|
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. Definition at line 763 of file kmdcodec.cpp. References update(). |
|
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 QCString as its argument. Definition at line 769 of file kmdcodec.cpp. References update(). |
Member Function Documentation
|
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!
Definition at line 442 of file kmdcodec.h. Referenced by finalize(), KMD5(), and update(). |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 785 of file kmdcodec.cpp. References endl(), transform(), and update(). |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 775 of file kmdcodec.cpp. References update(). |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 780 of file kmdcodec.cpp. References QCString::length(), and update(). |
|
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.
Definition at line 828 of file kmdcodec.cpp. References QIODevice::atEnd(), QIODevice::readBlock(), and update(). |
|
Calling this function will reset the calculated message digest. Use this method to perform another message digest calculation without recreating the KMD5 object. Definition at line 939 of file kmdcodec.cpp. |
|
Definition at line 887 of file kmdcodec.cpp. References finalize(). Referenced by verify(). |
|
Fills the given array with the binary representation of the message digest. Use this method if you do not want to worry about making copy of the digest once you obtain it.
Definition at line 893 of file kmdcodec.cpp. References finalize(). |
|
Returns the value of the calculated message digest in a hexadecimal representation.
Definition at line 900 of file kmdcodec.cpp. References finalize(). Referenced by verify(). |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 913 of file kmdcodec.cpp. References finalize(), and QCString::resize(). |
|
Returns the value of the calculated message digest in a base64-encoded representation.
Definition at line 923 of file kmdcodec.cpp. References finalize(). |
|
returns true if the calculated digest for the given message matches the given one.
Definition at line 875 of file kmdcodec.cpp. References finalize(), rawDigest(), and verify(). Referenced by verify(). |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 881 of file kmdcodec.cpp. References finalize(), hexDigest(), and verify(). |
|
Performs the real update work. Note that length is implied to be 64. Definition at line 955 of file kmdcodec.cpp. References transform(). Referenced by transform(), and update(). |
|
finalizes the digest
Definition at line 839 of file kmdcodec.cpp. References update(). Referenced by base64Digest(), hexDigest(), rawDigest(), and verify(). |
The documentation for this class was generated from the following files: