[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/oscar/liboscar
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2008-12-07 13:25:59
Message-ID: 1228656359.438387.16367.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 893826 by chehrlic:

md5.c -> QCryptographicHash(QCryptographicHash::Md5)

 M  +0 -1      CMakeLists.txt  
 M  +9 -12     tasks/oscarlogintask.cpp  
 M  +1 -1      tasks/oscarlogintask.h  
 D             utils/md5.c  
 D             utils/md5.h  


--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/CMakeLists.txt \
#893825:893826 @@ -86,7 +86,6 @@
     tasks/icqtlvinforequesttask.cpp
     tasks/icqtlvinfoupdatetask.cpp
     utils/rtf.cc
-    utils/md5.c
 )
 
 kde4_add_library( oscar SHARED ${liboscar_SRCS} )
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/tasks/oscarlogintask.cpp \
#893825:893826 @@ -18,6 +18,8 @@
 */
 #include "oscarlogintask.h"
 
+#include <QtCore/QCryptographicHash>
+
 #include <stdlib.h>
 #include <kdebug.h>
 #include <klocale.h>
@@ -26,8 +28,6 @@
 #include "oscarutils.h"
 #include "transfer.h"
 
-#include "md5.h"
-
 using namespace Oscar;
 
 OscarLoginTask::OscarLoginTask( Task* parent )
@@ -155,9 +155,7 @@
 	Buffer *outbuf = new Buffer;
 	outbuf->addTLV(0x0001, client()->userId().toLatin1());
 
-	QByteArray digest;
-	digest.resize( 16 ); //apparently MD5 digests are 16 bytes long
-	encodePassword( digest );
+	QByteArray digest = encodePassword();
 
 	const Oscar::ClientVersion* version = client()->version();
 	outbuf->addTLV(0x0025, digest );
@@ -247,15 +245,14 @@
 	setSuccess( 0, QString() );
 }
 
-void OscarLoginTask::encodePassword( QByteArray& digest ) const
+QByteArray OscarLoginTask::encodePassword() const
 {
 	kDebug(OSCAR_RAW_DEBUG) ;
-	md5_state_t state;
-	md5_init( &state );
-	md5_append( &state, ( const md5_byte_t* ) m_authKey.data(), m_authKey.size() );
-	md5_append( &state, ( const md5_byte_t* ) client()->password().toLatin1().data(), \
                client()->password().length() );
-	md5_append( &state, ( const md5_byte_t* ) AIM_MD5_STRING, strlen( AIM_MD5_STRING ) \
                );
-	md5_finish( &state, ( md5_byte_t* ) digest.data() );
+	QCryptographicHash h(QCryptographicHash::Md5);
+	h.addData( m_authKey );
+	h.addData( client()->password().toLatin1() );
+	h.addData( AIM_MD5_STRING, strlen( AIM_MD5_STRING ) );
+	return h.result();
 }
 
 //kate: indent-mode csands; tab-width 4; replace-tabs off; indent-spaces off;
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/tasks/oscarlogintask.h \
#893825:893826 @@ -46,7 +46,7 @@
 
 private:
 	//! Encodes a password using MD5
-	void encodePassword( QByteArray& digest ) const;
+	QByteArray encodePassword() const;
 
 	//! Send SNAC 0x17, 0x06
 	void sendAuthStringRequest();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic