:: printable version ::

MD5 hashing algorithm

::description ::changelog ::requirements ::features ::known issues ::usage ::tech ::

Description

A small class implementing Ron Rivest's MD5 hashing algorithm.

The class is based on the code written by Colin Plumb in 1993 (my understanding is that no copyright is claimed and that this code is in the public domain).

Changelog

Requirements

Features

Known issues and bugs

::top::

Usage example

Compute MD5 hash for a file or byte array:

#include <QByteArray> #include "md5hash.h" // ... // You better chose a different filename ;) QString filename("/dev/random"); QString s("Hello World!"); QByteArray buffer = s.toAscii(); QString digest1 = MD5Hash::hashFile(filename); // Let's hash the world!! QString digest2 = MD5Hash::hashData(buffer); // ...or just some bytes // ...

Everything is static, so you don't need to instantiate any class.

Technical details

Sensitive data

If you are handling sensitive data you may want to "clean" the md5Context struct before leaving the hashFile() method. You can use a simple memset(context, 0, sizeof(context)) for this purpose.

Indians?

Colin Plumb's original implementation is indianness-aware. I removed all the calls to a function called byteReverse() as I didn't need Big Indian CPU support (sorry Motorola-CPU freaks ;).

:: index :: top ::