Joomla 1.5 password hash Class 1.0 for QT using C++ - Joomla! Forum - community, help and support


hi joomla developers

this class mad projects.
i need under development work in point.

i wanted shear all
to make use of in applications may need to
have access joomla database , connect using qt library.
using c++.. work @ windows,linux, unix, mac or mobiles will..
image

for example if have database connected joomla 1.5
and has got database structure,
but in application need pass username , password
and need tool decrypt password users type in applications

this class decrypt password or create new password joomla.
if want application add new users joomla. user able login
to site if registered using application.

as application can downloaded , installed. in point need verify user in our joomla database or not , password correct or not..


file joomla15passwordhash.h

code: select all

/*   joomla 1.5 password hash class 1.0
 *   copyright
 *   smart neural tech ltd
 *   www.smartneural.com
 *   rajab@smartneural.com
 *
 *   developer name: rajab natshah
 *                   rajab@natshah.com
 *
 *   this class helps use username , passwords
 *   from joomla 1.5 database cryptographic hash using qt library.
 *   and c++ class.
 *
 */

#ifndef joomla15passwordhash_h
#define joomla15passwordhash_h
//
#include <stdlib.h>
#include <time.h>
#include <qstring>
#include <qstringlist>
#include <qbytearray>
#include <qcryptographichash>
//
class joomla15passwordhash
{
private:

public:
   joomla15passwordhash();
   bool check(qstring passwd,qstring dbentry);
   qstring create(qstring passwd);
   qstring md5(qstring data);
};
#endif




file joomla15passwordhash.cpp

code: select all

/*   joomla15passwordhash class 1.0
 *   copyright
 *   smart neural tech ltd
 *   www.smartneural.com
 *   rajab@smartneural.com
 *
 *   developer name: rajab natshah
 *                   rajab@natshah.com
 *
 *   this class helps use username , passwords
 *   from joomla 1.5 database cryptographic hash using qt library.
 *   and c++ class.
 *
 */



#include "joomla15passwordhash.h"
//
joomla15passwordhash::joomla15passwordhash()
{

}
bool joomla15passwordhash::check(qstring passwd,qstring dbentry)
{

            // new format {hash}:{salt}
            qstringlist aar = dbentry.split(":");
            qstring cryptpass = aar[0];
            qstring salt = aar[1];
            bool result = (md5(passwd+salt) == cryptpass);
            return result ;

}

qstring joomla15passwordhash::create(qstring passwd)
{
   qstring salt;
    int _rnd;
   srand ( time(null) );
   for (int i=0;i<32;i++)
   {
      _rnd = rand()%36+1;
      salt.append(qstring::number(_rnd,36));
   }
   return md5(passwd+salt)+":"+salt;
}

qstring joomla15passwordhash::md5(qstring data) {
      qbytearray bdata;
      bdata.resize(data.length());
      int i;
      qbytearray hash;
     
        bdata = data.toutf8();
       for (i=0;i<data.length();i++)
          bdata[i]= bdata[i]&0xff;

      hash = qcryptographichash::hash(bdata, qcryptographichash::md5);

      qstring r;
     
       for (i=0;i<hash.length();i++) {
         qstring x = qstring::number(hash[i]&0xff,16);
         if (x.length()<2) r.append("0");
         r.append(x);
      }

      return r;
}
//



i hope can use in projects.
and i'm available.

i have attached files can use them directly in development under qt library

best regards
rajab natshah






Comments

Popular posts from this blog

How to decompile jsxbin to jsx

Gavik Photoslide GK2: Not able to upload photos - Joomla! Forum - community, help and support

Phoca Guestbook logger registret bruger af - Joomla! Forum - community, help and support