Port things from MSN to WLM plugin:
[kdenetwork.git] / kopete / protocols / msn / msnchallengehandler.h
blob5dec955347801fdfe40e4818e5de1e086357b851
1 /*
2 msnchallengehandler.h - Computes a msn challenge response hash key.
4 Copyright (c) 2005 by Gregg Edghill <gregg.edghill@gmail.com>
5 Kopete (c) 2003-2005 by The Kopete developers <kopete-devel@kde.org>
7 Portions taken from
8 http://msnpiki.msnfanatic.com/index.php/MSNP11:Challenges
10 *************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 *************************************************************************
20 #ifndef MSNCHALLENGEHANDLER_H
21 #define MSNCHALLENGEHANDLER_H
23 #include <qobject.h>
24 #include <QVector>
26 /**
27 * Provides a simple way to compute a msn challenge response hash key.
29 * @author Gregg Edghill
31 class MSNChallengeHandler : public QObject
33 Q_OBJECT
34 public:
35 MSNChallengeHandler(const QString& productKey, const QString& productId);
36 ~MSNChallengeHandler();
38 /**
39 * Computes the response hash string for the specified challenge string.
41 QString computeHash(const QString& challengeString);
43 /**
44 * Returns the product id used by the challenge handler.
46 QString productId();
48 private:
50 /**
51 * Creates a 64-bit hash key.
53 qint64 createHashKey(const QVector<qint32>& md5Integers, const QVector<qint32>& challengeIntegers);
55 /**
56 * Swaps the bytes in a hex string.
58 QString hexSwap(const QString& in);
60 QString m_productKey;
61 QString m_productId;
64 #endif