MD5Hash.h

Idź do dokumentacji tego pliku.
00001 /****************************************************************************
00002 ** Filename: MD5Hash.h
00003 ** Last updated [dd/mm/yyyy]: 01/10/2005
00004 **
00005 ** Computes MD5 hash of a file or buffer [Requires Qt4 - QtCore module].
00006 **
00007 ** The MD5 algorithm was written by Ron Rivest.
00008 ** This class is based on the code written by Colin Plumb in 1993,
00009 ** our understanding is that no copyright is claimed and that this code is in
00010 ** the public domain.
00011 **
00012 ** NO WARRANTY is given for this code.
00013 ** Use it at your own risk.
00014 ** It should produce correct SHA1 digests, but no security-related test has been made.
00015 **
00016 ** Copyright (C) 2005 Angius Fabrizio. All rights reserved.
00017 **
00018 ** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
00019 **
00020 ** This file may be distributed and/or modified under the terms of the
00021 ** GNU General Public License version 2 as published by the Free Software
00022 ** Foundation and appearing in the file LICENSE.GPL included in the
00023 ** packaging of this file.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See the file LICENSE.GPL that came with this software distribution or
00029 ** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
00030 **
00031 **********************************************************************/
00032 
00033 #ifndef MD5HASH_H
00034 #define MD5HASH_H
00035 
00036 class QByteArray;
00037 class QString;
00038 class QFile;
00039 
00040 class MD5Hash
00041 {
00042 public:
00043         static QString hashData(const QByteArray& bytes);
00044         static QString hashData(const char* bytes, int size);
00045         static QString hashFile(QFile& file);
00046         static QString hashFile(const QString& filename);
00047 
00048 private:
00049         struct md5Context
00050         {
00051                 unsigned int buffer[4];
00052                 unsigned int bits[2];
00053                 unsigned char in[64];
00054         };
00055 
00056         static void updateHash(md5Context* context, const char* data, long int length);
00057         static void md5Transform(unsigned int buf[4], unsigned int const in[16]);
00058         static QString finalize(md5Context& ctx);
00059 };
00060 
00061 #endif // MD5HASH_H

Wygenerowano Sun Jun 11 12:55:08 2006 dla lanChat programem  doxygen 1.4.6