Results 1 to 2 of 2

Thread: Simple Encrypt For Qt and PHP

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Default Simple Encrypt For Qt and PHP

    I found simple encrypt/decrypt for PHP here.

    The result is:
    Enc: 6dXM5pPw0ODLi+LR1pPX4I/X0t7g4srj5uA=
    Dec: teks yang mau di enskripsi
    I try decrypt from Qt with this function, but failed

    Qt Code:
    1. QString Dialog::dec(const QByteArray &teks, const QString &pwd) const
    2. {
    3. QString result;
    4. QString string(QByteArray::fromBase64(teks).constData());
    5.  
    6. int i;
    7. QChar chr;
    8. QChar keychr;
    9. for (i=0; i < string.length(); i++) {
    10. keychr=pwd.at( (i % pwd.length()) - 1 );
    11. chr = QChar(string.at(i).unicode() - keychr.unicode());
    12. result.append(chr);
    13. }
    14.  
    15. return result;
    16. }
    17.  
    18. ...
    19. ....
    20.  
    21. qDebug() << dec("6dXM5pPw0ODLi+LR1pPX4I/X0t7g4srj5uA=", "passwordku");
    To copy to clipboard, switch view to plain text mode 

    The Qt result is

    éeks yang âau di ensà ripsi
    I think there is something different between php and Qt

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Simple Encrypt For Qt and PHP

    Yes, the code

    BTW. It is hard to call what you have there "encryption". It's so weak it can be broken manually within minutes.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Encryptor: Simple project to encrypt and decrypt data.
    By luisvaldes88 in forum Qt Programming
    Replies: 0
    Last Post: 9th October 2012, 19:49
  2. Ho to encrypt with AES?
    By al3_85 in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2011, 00:01
  3. encrypt the content of a file
    By franco.amato in forum Qt Programming
    Replies: 9
    Last Post: 11th May 2011, 16:35
  4. How to encrypt Directory and File using Qt
    By akshar26 in forum Newbie
    Replies: 1
    Last Post: 1st July 2010, 00:19
  5. how to encrypt ?
    By probine in forum Qt Programming
    Replies: 3
    Last Post: 22nd November 2006, 19:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.