跳到內容
  • 版面
  • 最新
  • 標籤
  • 熱門
  • 使用者
  • 群組
  • 搜尋
  • Get Qt Extensions
  • Unsolved
Collapse
品牌標誌
  1. 首頁
  2. Behind the Scenes
  3. Wiki Discussion
  4. New SimpleCrypt page
Forum Updated to NodeBB v4.3 + New Features

New SimpleCrypt page

已排程 已置頂 已鎖定 已移動 Wiki Discussion
98 貼文 26 Posters 99.1k 瀏覽 1 Watching
  • 從舊到新
  • 從新到舊
  • 最多點贊
回覆
  • 在新貼文中回覆
登入後回覆
此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
  • Q 離線
    Q 離線
    qxorm
    寫於 最後由 編輯
    #41

    Hi,

    I read your article and it is very interesting !

    I am the developer of QxOrm library (Object Relational Mapping for C++/Qt) and I would like to use your class to encrypt/decrypt some datas. Indeed, QxOrm library provides QxService module to create C++/Qt application server. Here is a tutorial if you want to see QxService module : http://www.qxorm.com/qxorm_en/tutorial_2.html

    So it would be great with an option to encrypt data before transfering it over network.

    Can I use your class in QxOrm library ?
    Can I add namespace for your class ?
    Can I rename your class to add Qx prefix ?
    I will not change anything else.

    Thanks !

    PS: I´m french so sorry if my english is not perfect.

    1 條回覆 最後回覆
    0
    • C 離線
      C 離線
      cincirin
      寫於 最後由 編輯
      #42

      @Andre ... many, many apologies.
      Indeed your algorithm works well, what induced me in error was CPUID opcode, which I compared with decrypted string. I was convinced that CPUID opcode with all features was always the same. But sometimes some bits are different (maybe cache information, I'll study in a few days)
      Thanks anyway.

      1 條回覆 最後回覆
      0
      • A 離線
        A 離線
        andre
        寫於 最後由 編輯
        #43

        [quote author="cincirin" date="1316417041"]@Andre ... many, many apologies.
        Indeed your algorithm works well, what induced me in error was CPUID opcode, which I compared with decrypted string. I was convinced that CPUID opcode with all features was always the same. But sometimes some bits are different (maybe cache information, I'll study in a few days)
        Thanks anyway.[/quote]

        OK, glad to know that the issue is not in my code :-) Lots of luck in figuring out what is going wrong then!
        One more note: you might want to think about getting a better key. 1316417041 is only a 32 bits number (0x4E76EE11). You might want to considder generating a real 64 bit key instead.

        1 條回覆 最後回覆
        0
        • A 離線
          A 離線
          andre
          寫於 最後由 編輯
          #44

          [quote author="qxorm" date="1316359090"]Hi,

          I read your article and it is very interesting !
          [/quote]
          Thanks for the compliment :-)

          [quote]
          I am the developer of QxOrm library (Object Relational Mapping for C++/Qt) and I would like to use your class to encrypt/decrypt some datas. Indeed, QxOrm library provides QxService module to create C++/Qt application server. Here is a tutorial if you want to see QxService module : http://www.qxorm.com/qxorm_en/tutorial_2.html
          [/quote]
          I am very interested in ORM myself (and database drivers and the likes), and I have looked at QxORM before. Very nice effort!
          [quote]
          So it would be great with an option to encrypt data before transfering it over network.

          Can I use your class in QxOrm library ?
          Can I add namespace for your class ?
          Can I rename your class to add Qx prefix ?
          I will not change anything else.
          [/quote]
          Would the above be doable based on the current licence of the code, or would you need the code under a different licence? I do not have objections to you including this code in QxOrm in principle, so I guess we can figure something out.

          1 條回覆 最後回覆
          0
          • Q 離線
            Q 離線
            qxorm
            寫於 最後由 編輯
            #45

            I think it's ok for the licence : QxOrm library is under LGPL licence, so it seems compatible.

            I just want (if possible) include your class into the namespace qx and rename it from SimpleCrypt to QxSimpleCrypt (like other classes into QxOrm library).

            If I include your class into QxOrm library, I would like to set your name into the changes.txt file for the next version. Is it ok for you ?
            Something like this :
            New class qx::QxSimpleCrypt to provide encryption/decryption (thanks very much to Andre Somers) with QxService module : encrypt data before transfering it over network.

            1 條回覆 最後回覆
            0
            • A 離線
              A 離線
              andre
              寫於 最後由 編輯
              #46

              Seems fine to me, as long as the copyright notice & licence in the source files remains in tact (and is observed), I have no objections to your modifications. The licence explicitly allows you to modify the code for your own use, after all.

              Basically: I am fine with anybody using this code for any purpose, as long as:

              • You don't pretend you wrote it yourself, and
              • You don't make me responsible for your use of it or claim that I endorse it in some way.

              Other than that: I hope you find it useful, and have lots of success with any application you use it in :-)

              1 條回覆 最後回覆
              0
              • Q 離線
                Q 離線
                qxorm
                寫於 最後由 編輯
                #47

                Ok thanks, your SimpleCrypt class will be in the next version of QxOrm library ;-)

                1 條回覆 最後回覆
                0
                • A 離線
                  A 離線
                  andre
                  寫於 最後由 編輯
                  #48

                  Nice to know it is getting some use :-)

                  1 條回覆 最後回覆
                  0
                  • Q 離線
                    Q 離線
                    qxorm
                    寫於 最後由 編輯
                    #49

                    QxOrm 1.1.9 just released with your SimpleCrypt class (renamed to qx::QxSimpleCrypt).
                    For more details : http://www.qxorm.com/qxorm_en/download.html
                    Thanks again ;o)

                    1 條回覆 最後回覆
                    0
                    • S 離線
                      S 離線
                      saidiahd
                      寫於 最後由 編輯
                      #50

                      Hi Andre ,

                      a very nice work ,thanks

                      "Learn from yesterday, live for today, hope for tomorrow." - Albert Einstein -

                      1 條回覆 最後回覆
                      0
                      • M 離線
                        M 離線
                        mnosov
                        寫於 最後由 編輯
                        #51

                        Hi, Andre!

                        Thanks a lot for the article! I'd be glad to use this code in my project!

                        My question is also related to license. The project I'm working on is not an open-source. Is it ok if I copy/paste your code into my project (keeping copyright notice in source/header files)? Also my application doesn't have any 'About' page - is it OK that I'll not show to the end user your copyright notice (that you're the actual author of encryption)?

                        I have read your message above, my question is just for confirmation for my project

                        Thanks a lot in advance,
                        Michael

                        1 條回覆 最後回覆
                        0
                        • A 離線
                          A 離線
                          andre
                          寫於 最後由 編輯
                          #52

                          Your application is bound to have some documentation or help system, right? I'd think there is enough opportunity to fullfil the licence terms that way. Licences do not get much more liberal than the one I have used...

                          1 條回覆 最後回覆
                          0
                          • M 離線
                            M 離線
                            mnosov
                            寫於 最後由 編輯
                            #53

                            [quote author="Andre" date="1317372274"]Your application is bound to have some documentation or help system, right? I'd think there is enough opportunity to fullfil the licence terms that way. Licences do not get much more liberal than the one I have used...[/quote]
                            Ok, thanks, i'll add this notice to the global "copyright" file in the sources. I just needed confirmation that it is ok that this notice will not appear anywhere on the application's UI

                            1 條回覆 最後回覆
                            0
                            • A 離線
                              A 離線
                              andre
                              寫於 最後由 編輯
                              #54

                              The relevant part of the licence states:
                              [quote]Redistributions in binary form must reproduce the above copyright
                              notice, this list of conditions and the following disclaimer in the
                              documentation and/or other materials provided with the distribution.[/quote]

                              So, if you are providing other materials/documentation with the binairy application, then you must basically repeat the licence block in that documentation or additional materials. That can also occur in in-application help or something like that. If you distribute your application as source, then you can place it there (basically: just keep the source file as-is - at least in terms of the licence header - and you are ok.)

                              1 條回覆 最後回覆
                              0
                              • E 離線
                                E 離線
                                erwanage
                                寫於 最後由 編輯
                                #55

                                Hi,

                                First, Thanks for your work.
                                I'd like to use your class but i need some more help.
                                The constructor of SimpleCrypt only accept a quint64 as key.
                                But in my project, i have to convert a given passphrase (like "password") to this quint64 and cannot manage to do this.
                                You said in your topic "you can also use other means to get to a quint64 key, such as using some hash of a password and reducing that to 64 bits."
                                But i don't know how to do it.

                                Is there some easy way to do this?
                                Is there some existing class or wathever that do it?

                                regards.

                                1 條回覆 最後回覆
                                0
                                • K 離線
                                  K 離線
                                  koahnig
                                  寫於 最後由 編輯
                                  #56

                                  welcome to devnet

                                  Did you see already "qHash":http://developer.qt.nokia.com/doc/qt-4.8/qhash.html#qHash-22 ?

                                  Vote the answer(s) that helped you to solve your issue(s)

                                  1 條回覆 最後回覆
                                  0
                                  • A 離線
                                    A 離線
                                    andre
                                    寫於 最後由 編輯
                                    #57

                                    Well, the qHash function comes to mind, or perhaps you could use [[doc:QCryptographicHash]]. You add a bit a salt to your pass string, generate a hash, and combine the bits in the resulting hash to create a 64 bit value. If you use MD5, you get a 128bits hash. You could do something like this:

                                    @
                                    quint64 passToKey(const QString& password) {
                                    QByteArray hash;
                                    QCryptographicHash hasher(Md5);
                                    hasher.addData(salt); //salt is a QByteArray with some random data
                                    hasher.addData(password.toUtf8());
                                    hash = hasher.result();

                                    //we now have a QByteArray that is too long with a hash of the password.

                                    //get the contents of the byte array into two quint64's. There are other ways...
                                    quint64 part1, part2;
                                    QBuffer buffer(hash);
                                    QDataStream stream(&buffer);
                                    stream >> part1 >> part2;
                                    key = part1 ^ part2; //combine the two parts

                                    return key;
                                    }
                                    @

                                    Note: brain to editor, not tested.

                                    Edit:
                                    Note that qHash returns a 32 bits result, so you will have to combine two of these to get a 64 bits version. Perhaps using part of the password for hash1, and the other part for hash2, and then combining the result to get a 64 bits key.

                                    1 條回覆 最後回覆
                                    0
                                    • E 離線
                                      E 離線
                                      erwanage
                                      寫於 最後由 編輯
                                      #58

                                      Thanks for your help.
                                      I'm not at ease with with hashing and combining stuff :/
                                      How can you do that?
                                      How do you combine 2 unsigned int?

                                      1 條回覆 最後回覆
                                      0
                                      • A 離線
                                        A 離線
                                        andre
                                        寫於 最後由 編輯
                                        #59

                                        In the same way I do in the snippet I posted, for instance. I use bitshifting, but that is the same as multiplication by 2-to-the-power-of-n. Basically, what you do is:

                                        put the values of your ints in 64 bits variables

                                        shift one of the values 32 bits by either:

                                        multiplying by 0xFFFFFFFF, or

                                        bitshifting

                                        add the two numbers by either:

                                        simply adding the numbers, or

                                        using a binary OR operation like I did in my sample.

                                        1 條回覆 最後回覆
                                        0
                                        • R 離線
                                          R 離線
                                          rich
                                          寫於 最後由 編輯
                                          #60

                                          Just a note that this appears to be a Vigenere cipher scheme (see http://en.wikipedia.org/wiki/Vigenère_cipher for details) if you simply want basic scrambling of data to prevent trivial access to the plain text then this could well be sufficient, but it's not very strong. Particularly be careful of using this for long texts.

                                          1 條回覆 最後回覆
                                          0

                                          • 登入

                                          • Login or register to search.
                                          • 第一個貼文
                                            最後的貼文
                                          0
                                          • 版面
                                          • 最新
                                          • 標籤
                                          • 熱門
                                          • 使用者
                                          • 群組
                                          • 搜尋
                                          • Get Qt Extensions
                                          • Unsolved