New SimpleCrypt page
Page |
1 |
I have just added a page [developer.qt.nokia.com] in the Snippets category that details a class to deal with some simple encryption and decryption. I would really welcome any comments you may have, on the text of the Wiki page, the API of the class, or the strength of the encryption algorithm used. Note that I am not an expert in cryptography :-)
Would it be useful to add a section discussing the actual algorithm used in the class?
85 replies
Andre, I think it’s useful.
This kind of cipher as you explain seems simple and efficient, just what a lot of mobile developers needs to give to their applications the option for data to be “unreadable by others”.
I am thinking to those that I am developing: naijanimi (at projects.forum.nokia.com/naijanimi; restricted access) It is at an early stage but I should (to be clear: I SHOULD ;) ) go ahead very fast this next w.e. The encryption capability, not really required by the customer, is missing but needed: it is an application to send free SMS and some data (just user and login, phone number etc) are saved on the phone and if they are encrypted it is best.
Edit: make link into real link, and added note on restricted access to page; Andre
Hi Andre, I can if you explain to me a bit more what do yo have in mind. What I am thinking is to use this class in an application that I am building in these days, so the reference code can became a set of snippets for users that want to use, while the application itself can be a usage sample (it is shared on projects.forum.nokia.com/najianimi). The informations can be collected in the wiki integrating the page you have already wrote.
Andre, I was no clear in my thought. The page is clear, as is, with the snippet. I agree that a wiki page with too much code became confusing. What I mean is that integrating your page, with a little more documentation about encryption and a project that can be an example (that use in a precise vode source your class) can be useful.
Usually what I find in documentation on the net regarding encryption or similar, is too much code or too much teory.
I am currently working on a version 2, with these added features:
- optional integrity checks using a checksum or a cryptographic hash
- error reporting
- slightly higher security due to added random character. That should make it harder to guess the first byte of the key based on the fact that there are only a limited number of characters used normally. Should increase effective key length by an guestimated 3 bits.
If you miss the documentation tools discussion: I’ve split it out to a new thread [developer.qt.nokia.com]
I have added a separate page [developer.qt.nokia.com] that details the algorithm and the layout of the cypher text. Of course, I also added a link from the main page.
Hi Andre,
First: Thanks for sharing the code.
Second: You’ve got some typos in the Example usage code.
- Name of the Class: SimpleCypt —> SimpleCrypt
- crypto.setCompression(SimpleCrypto::CompressionAlways)
- crypto.setCompressionMode(SimpleCrypt::CompressionAlways);
- crypto.setIntegrityProtection(SimpleCrypto::ProtectHash);
- crypto.setIntegrityProtectionMode(SimpleCrypt::ProtectionHash);
- SimpleCrypt.ErrorNoError —> SimpleCrypt::ErrorNoError
Third:
The String Encryption and Decryption works fine, but for the binary version I seem to be having some difficulties.
my main.cpp
- #include "simplecrypt.h"
- #include <QString>
- #include <QDebug>
- #include <QBuffer>
- #include <QDataStream>
- int main(){
- SimpleCrypt crypto(Q_UINT64_C(0x7F29B208)); //some random number
- // crypto.setCompressionMode(SimpleCrypt::CompressionAlways);
- // crypto.setIntegrityProtectionMode(SimpleCrypt::ProtectionHash);
- QBuffer txB;
- s << txStr;
- if (crypto.lastError() == SimpleCrypt::ErrorNoError) {
- qDebug() << cypherBytes;
- }
- SimpleCrypt cryptu(Q_UINT64_C(0x7F29B208)); //some random number
- if (!cryptu.lastError() == SimpleCrypt::ErrorNoError) {
- qDebug() << "decrypt error";
- return 0;
- }
- qDebug() << plainBytes;
- QString rxStr;
- rs >> rxStr;
- qDebug() << rxStr;
- return 0;
- }
My Output (console):
“??Sß+”
“”
“”
What have I missed or using incorrectly?
Thanks again for the contribution.
You must log in to post a reply. Not a member yet? Register here!






